-
Notifications
You must be signed in to change notification settings - Fork 0
/
TimeTools.h
49 lines (41 loc) · 1.46 KB
/
TimeTools.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef _TIMETOOLS_H_
#define _TIMETOOLS_H_
#include "ToolsDefine.h"
#include <ctime>
#include <sys/timeb.h>
TOOLSPACE_BEGIN
class TimeTools
{
static DString m_strZoneInfo;
TimeTools();
~TimeTools();
public:
// Function: Get local timezone offset
// in: none
// out: out_iTZOffset(timezone offset)
// return: bool
// true: get success
// false: get failed
// Linux version complete. Tested.
// Windows version complete. Did not test and verify.
static bool getLocalTZOffset(DFloat8 & out_iTZOffset);
// Function: Set zoneinfo database path
// in: in_strPath(zoneinfo path of the OS)
// out: none
// return: void
static void setZoneinfoPath(const DString & in_strPath);
// Function: Get timezone offset by timezone name.
// in: in_strZoneName
// out: out_iTZOffset
// return: bool
// true: get success
// false: get failed
// example: Asia/Shanghai => 28800
// incomplete
static bool getTZOffsetByZonename(const DString & in_strZoneName, DFloat8 & out_iTZOffset);
// Function: Returns the current time as milliseconds since the Epoch,
// 1970-01-01 00:00:00 +0000 (UTC)
static DTime_t getMilliTime();
}; // class TimeTools
TOOLSPACE_END
#endif