-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdatetime.cpp
More file actions
33 lines (29 loc) · 1004 Bytes
/
datetime.cpp
File metadata and controls
33 lines (29 loc) · 1004 Bytes
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
#include <datetime.h>
//------------------------------------------------------------------------------
#ifdef ENCLAVED
struct tm* std::gmtime(std::time_t *in) {
static struct tm ret;
::sgx_gmtime_r(in, &ret);
return &ret;
}
#endif
//------------------------------------------------------------------------------
std::string DateTime::toString(DateFormat::Format f) {
char tstr[100];
const char *format;
switch (f) {
case DateFormat::SIGNER_DATE_FORMAT:
format = "%Y%m%d";
break;
case DateFormat::AMZ_DATE_FORMAT:
format = "%Y%m%dT%H%M%SZ";
break;
};
if (std::strftime(tstr, sizeof(tstr), format, std::gmtime(&time_))) {
return tstr;
}
return "";
}
//------------------------------------------------------------------------------
DateTime DateTime::parseDateTime(const std::string &) { return DateTime(); }
//------------------------------------------------------------------------------