sipxportlib  Version 3.3
OsDateTimeLinux.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2004-2006 SIPfoundry Inc.
3 // Licensed by SIPfoundry under the LGPL license.
4 //
5 // Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
6 // Licensed to SIPfoundry under a Contributor Agreement.
7 //
8 // $$
10 
11 #ifndef _OsDateTimeLinux_h_
12 #define _OsDateTimeLinux_h_
13 
14 // SYSTEM INCLUDES
15 
16 // APPLICATION INCLUDES
17 #include "os/OsDefs.h"
18 #include "os/OsDateTime.h"
19 
20 // DEFINES
21 // MACROS
22 // EXTERNAL FUNCTIONS
23 // EXTERNAL VARIABLES
24 // CONSTANTS
25 // STRUCTS
26 // TYPEDEFS
27 // FORWARD DECLARATIONS
28 
29 //:DateTime management functions for Linux
31 {
32 /* //////////////////////////// PUBLIC //////////////////////////////////// */
33 public:
34 
35 /* ============================ CREATORS ================================== */
36 
38  //:Default constructor
39 
40  OsDateTimeLinux(const unsigned short year,
41  const unsigned char month,
42  const unsigned char day,
43  const unsigned char hour,
44  const unsigned char minute,
45  const unsigned char second,
46  const unsigned int microsecond);
47  //:Constructor
48 
49  OsDateTimeLinux(const OsDateTimeLinux& rOsDateTimeLinux);
50  //:Copy constructor
51 
53  OsDateTimeLinux(const OsTime& toTime);
54 
55  virtual
57  //:Destructor
58 
59 /* ============================ MANIPULATORS ============================== */
60 
62  //:Assignment operator
63 
64  static void setTime(struct timespec gmt, int tzOffsetSecs,
65  DstRule dstRule);
66  //:Set the system time
70 
71  static void setTimeZone(int tzOffsetSecs, DstRule dstRule);
72  //:Set the time zone and daylight savings time information
75 
76 /* ============================ ACCESSORS ================================= */
77 
78  virtual OsStatus cvtToTimeSinceBoot(OsTime& rTime) const;
79  //:Convert the OsDateTimeBase value to an OsTime value
80  // The OsTime value is relative to when the system was booted.
81 
82  static void getCurTime(OsDateTimeLinux& rDateTime);
83  //:Return the current time as an OsDateTime value
84 
86  static void getCurTime(OsTime& rTime);
87 
88  static void getCurTimeSinceBoot(OsTime& rTime);
89  //:Return the current time as an OsTime value
90  // The OsTime value is relative to when the system was booted.
91 
92  static unsigned long getSecsSinceEpoch(void);
93  //:Current time as the number of seconds since midnight (0 hour) 01/01/70
94 
95  static double secondsSinceBoot(void);
96  //:Get seconds since boot under Linux using /proc/uptime
97 
98 /* ============================ INQUIRY =================================== */
99 
100 /* //////////////////////////// PROTECTED ///////////////////////////////// */
101 protected:
102 
103 /* //////////////////////////// PRIVATE /////////////////////////////////// */
104 private:
105 
106 };
107 
108 /* ============================ INLINE METHODS ============================ */
109 
110 #endif // _OsDateTimeLinux_h_
111 
static void setTime(struct timespec gmt, int tzOffsetSecs, DstRule dstRule)
Definition: OsDateTimeLinux.cpp:112
Definition: OsDateTimeLinux.h:30
static unsigned long getSecsSinceEpoch(void)
Definition: OsDateTimeLinux.cpp:209
virtual ~OsDateTimeLinux()
Definition: OsDateTimeLinux.cpp:90
OsDateTimeLinux & operator=(const OsDateTimeLinux &rhs)
Definition: OsDateTimeLinux.cpp:99
OsStatus
Definition: OsStatus.h:27
static double secondsSinceBoot(void)
Definition: OsDateTimeLinux.cpp:215
OsDateTimeLinux()
Definition: OsDateTimeLinux.cpp:43
static void getCurTime(OsDateTimeLinux &rDateTime)
Definition: OsDateTimeLinux.cpp:175
DstRule
Definition: OsDateTime.h:59
static void setTimeZone(int tzOffsetSecs, DstRule dstRule)
param: (in) gmt - time relative to the beginning of 1970 (GMT) param: (in) tzOffsetSecs - local time ...
Definition: OsDateTimeLinux.cpp:119
Definition: OsTime.h:37
Definition: OsDateTime.h:54
virtual OsStatus cvtToTimeSinceBoot(OsTime &rTime) const
param: (in) tzOffsetSecs - local time offset (seconds relative to GMT) param: (in) dstRule - daylight...
Definition: OsDateTimeLinux.cpp:128
static void getCurTimeSinceBoot(OsTime &rTime)
Definition: OsDateTimeLinux.cpp:194