The return value of "mktime" in different time zone
来源:互联网 发布:dns cache 域名劫持 编辑:程序博客网 时间:2024/05/17 20:27
For time zones that are ahead of Coordinated Universal Time (Greenwich Mean Time), if you call the mktime function with the argument set to correspond to January 1, 1970 00:00:00 (midnight), mktime returns -1 (failure).
For example, this behavior occurs in the time zone for Cairo, Egypt. This time zone is Coordinated Universal Time + 2. This means that the time in Cairo is two hours ahead of Coordinated Universal Time.
The Visual C++ 4.0 Books Online states:
"...mktime handles dates in any time zone from midnight, January 1, 1970, to midnight, February 5, 2036."
===============================================================
The problem is not that the mktime function is in error. Instead, the problem is that the documentation states that this function will handle midnight January 1, 1970 in any time zone. Actually, the mktime function returns the number of seconds that have elapsed since January 1, 1970 00:00:00, adjusted for the current time zone. Adjusted for current time zone means that the appropriate number of seconds will be added or subtracted so the mktime function actually returns the number of seconds that have elapsed since midnight January 1, 1970 Coordinated Universal Time. This means that if you call the mktime function for January 1, 1970 in the Pacific Time Zone (Coordinated Universal Time - 8), 28800 is returned. This value is the number of seconds that are contained in 8 hours. The return value of 28800 in the Pacific Time Zone means that 28,800 seconds have elapsed since January 1, 1970 00:00:00 Coordinated Universal Time when it is the same time in the Pacific Time Zone. The problem occurs in time zones that are ahead of Coordinated Universal Time. If you call the mktime function in Cairo (Coordinated Universal Time + 2), a value of -1 is returned for January 1, 1970 00:00:00, because January 1, 1970 00:00:00 had not yet occured in Coordinated Universal Time when the same time happened in Cairo.
Source link: http://support.microsoft.com/kb/148790
- The return value of "mktime" in different time zone
- The server time zone value '?????' more than one time zone
- mysql The server time zone value 异常
- mysql The server time zone value 异常
- The Value of Time
- The server time zone value 'EDT' is unrecognized or represents more than one time zone.
- Mysql错误:The server time zone value is unrecognized or represents more than one time zone
- The server time zone value 'PDT' is unrecognized or represents more than one time zone
- 【MySql】异常:The server time zone value 'EDT' is
- MySQL5.7 The server time zone value 异常处理
- [QTP] Retrieves the value of the cell in the specified row of the parameter in the run-time Data Tab
- return value of operator overloading in C++
- About the return value of SetTimer function
- mysql出现错误:The server time zone value is unrecognized or represents more than one time zone
- return the minimum value in a stack
- php5.3 的问题 “Assigning the return value of new by reference is deprecated in xxxx”
- Assigning the return value of new by reference is deprecated in xxxx
- php报错:Deprecated: Assigning the return value of new by reference is deprecated in
- Cindy User Guide
- 防盗链的基本原理与实现
- Effective C++ Item 2:Prefer constS, enumS, and inlineS to #defineS
- The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the serv
- 软件测试经验与教训
- The return value of "mktime" in different time zone
- js 判断当前浏览器JavaScript的版本
- 《多线程服务器的适用场合》-- 例释与答疑
- 记在第三份工作满月之时
- 牧云者第一章
- SAP BDC详解
- 毕业设计中用到的一些
- POS58 票据热敏打印机,怎么用ESC/POS命令控制打印文字大小?
- 将 Debian APT 引入 iPhone