This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
programming:cpp:unixtime [2022/05/05 07:45] odagawa created |
programming:cpp:unixtime [2022/09/12 08:38] (current) odagawa |
||
---|---|---|---|
Line 14: | Line 14: | ||
// int64_t unixtime_i = 1651736619; // 2022-05-05 16:43:39 | // int64_t unixtime_i = 1651736619; // 2022-05-05 16:43:39 | ||
- | // time_t now = (time_t)unixttime_t; | + | // time_t now = (time_t)unixtime_t; |
| | ||
time_t now = std:: | time_t now = std:: | ||
- | tm *tm_event = localtime(& | + | tm *tm_event = localtime(& |
| | ||
int year = tm_event-> | int year = tm_event-> | ||
int month = tm_event-> | int month = tm_event-> | ||
int day = tm_event-> | int day = tm_event-> | ||
+ | | ||
+ | std::cout << year << "/" | ||
std:: | std:: | ||
Line 29: | Line 31: | ||
</ | </ | ||
- | '' | + | '' |
+ | <code cpp> | ||
+ | struct tm { | ||
+ | int tm_sec; | ||
+ | int tm_min; | ||
+ | int tm_hour; | ||
+ | int tm_mday; | ||
+ | int tm_mon; | ||
+ | int tm_year; | ||
+ | int tm_wday; | ||
+ | int tm_yday; | ||
+ | int tm_isdst; | ||
+ | long tm_gmtoff; /* offset from CUT in seconds */ | ||
+ | char *tm_zone; | ||
+ | }; | ||
+ | </ | ||
+ | |||
+ | [[https:// |