This source file includes following definitions.
- SystemTime
- SystemTimeAsStr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 #pragma once
22
23 #include"../../../core/ttypes.hpp"
24 #include<iomanip>
25 #include<ostream>
26 #include<sstream>
27 #include<string>
28
29 namespace jmmcg {
30
31 namespace NTUtils {
32
33 inline tostream &SystemTime(tostream &ss) {
34 SYSTEMTIME time;
35 ::GetSystemTime(&time);
36 ss<<std::setw(2)<<std::setfill(_T('0'))<<time.wHour<<_T(':')
37 <<std::setw(2)<<std::setfill(_T('0'))<<time.wMinute<<_T(':')
38 <<std::setw(2)<<std::setfill(_T('0'))<<time.wSecond<<_T('.')
39 <<std::setw(3)<<std::setfill(_T('0'))<<time.wMilliseconds<<_T(" - ")
40 <<std::setw(2)<<std::setfill(_T('0'))<<time.wDay<<_T('/')
41 <<std::setw(2)<<std::setfill(_T('0'))<<time.wMonth<<_T('/')
42 <<std::setw(2)<<std::setfill(_T('0'))<<time.wYear;
43 return ss;
44 }
45
46 inline tstring SystemTimeAsStr(void) {
47 tstringstream ss;
48 SystemTime(ss);
49 return ss.str();
50 }
51
52 }
53
54 }