【发布时间】:2017-10-26 20:29:54
【问题描述】:
#include <iostream>
int main(){
std::time_t t = 893665799;
std::tm * tm = std::localtime(&t);
printf("local time duration =>year:%d, month:%d, day:%d, hour:%d, min:%d, sec:%d\n",tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);
t = 893665800;
tm = std::localtime(&t);
printf("local time duration =>year:%d, month:%d, day:%d, hour:%d, min:%d, sec:%d\n",tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);
}
893665799 是一个神奇的 UTC。
当您将时区更改为 皮特凯恩群岛。
日志如下所示
本地时长 =>年:98,月:3,日:26,小时:23,分钟:59,秒:59
本地时长 =>年:98,月:3,日:27,小时:0,分钟:30,秒:0
发生了什么事?为什么1秒导致30分钟的差距?
【问题讨论】:
-
您是否将时区更改为皮特凯恩群岛?