33 static const int daysOfMonth[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
60 std::time_t unix_time;
65 std::strftime(buf,
sizeof(buf),
"%Y-%m-%d %H:%M:%S", std::localtime(&unix_time));
98 using namespace std::chrono;
99 auto duration = system_clock::now().time_since_epoch();
101 return duration_cast<milliseconds>(duration).count();
106 using namespace std::chrono;
111 auto duration = system_clock::now().time_since_epoch();
112 double time = duration_cast<microseconds>(duration).count();
113 return (time / 1000);
118 using namespace std::chrono;
119 auto duration = system_clock::now().time_since_epoch();
120 double time = duration_cast<nanoseconds>(duration).count();
121 return (time / 1000);
126 time_t now = std::time(0);
129 tstruct = *std::localtime(&now);
132 std::strftime(buf,
sizeof(buf),
"%Y-%m-%d.%X", &tstruct);
140 if (elapsed > 999999)
141 return sprintf(
"0.4fs",elapsed / 1000000);
142 else if (elapsed > 999)
143 return sprintf(
"0.4fms",elapsed / 1000);
145 return sprintf(
"0.4fus",elapsed);
152 return sprintf(
"0.4fs",elapsed / 1000);
154 return sprintf(
"0.4fms",elapsed);
164 uint16 day = (time / 86400) +1;
165 uint16 seconds = fmod(time, 86400);
170 if ((year % 400 == 0)
171 or ((year % 4 == 0) and (year % 100 != 0))) {
180 if ((year % 400 == 0)
181 or ((year % 4 == 0) and (year % 100 != 0)))
185 uint8 month(0), index(0);
215 if (month == 2 && flag)
223 boost::gregorian::date d(year, month, day);
229 data.
wn = d.week_number();
230 data.
wd = d.day_of_week();
231 data.
dy = d.day_of_year();
232 data.
hour = seconds / 3600;
233 data.
min = fmod(seconds, 3600) / 60;
234 data.
sec = fmod(fmod(seconds, 3600), 60);
235 data.
ms = fmod(time, 1000);
const int64 Win32Time_Year
std::string GetMTimeTillNow(double fromTime)
int64 UnixTimeToWin32Time(time_t sec, uint32 nsec)
std::string sprintf(const char *fmt,...)
sprintf for std::string.
static const int daysOfMonth[]
const int64 Win32Time_Day
const int64 Win32Time_Month
int32 GetElapsedHours(int64 time)
const int64 Win32Time_Hour
const std::string currentDateTime()
static const int64 SECS_TO_100NS
static const int64 SECS_BETWEEN_EPOCHS
const int64 Win32Time_Second
EvE::TimeParts GetTimeParts(int64 filetime)
const int64 Win32Time_Minute
std::string Win32TimeToString(int64 win32t)
std::string GetUTimeTillNow(double fromTime)
void Win32TimeToUnixTime(int64 win32t, time_t &unix_time, uint32 &nsec)