C 时间函数问题
Issue with c++ time function.
因此,我正在使用功能以从555550的偏移中获得时间的时间,该值应给出10:19:09的值。但是,当我使用GMTime和Asctime时,我的价值为10秒而不是9秒,而我不明白为什么我会休息一秒钟。有人可以解释一下吗?
这是我正在测试的代码:
#include <stdio.h>
#include <time.h>
int main (void)
{
time_t now = 555550;
printf ("The time is %s", asctime (localtime (&now)));
printf ("UTC time is %s", asctime (gmtime (&now)));
return 0;
}
您的计算是错误的:请参阅http://www.epochconverter.com/。10秒是正确的。当通过60的修改时,一个数字如何最终为9?
根据http://www.epochconverter.com/555550的价值是星期三,1970年1月7日10:19:10格林尼治标准时间,因此您的假设约为10:19:09是错误的。
相关文章:
- Visual Studio中的函数声明和函数定义问题
- C++quit()函数中可能存在作用域问题
- 类似于strcat()的函数出现问题
- 当调用switch语句中的函数时(即使函数不包含循环),似乎是永不结束的循环的问题
- 类C++中的函数问题(LNK2019和LNK1120错误)
- c++binary_search函数排序数组(流行名称搜索)出现问题
- 关于简单C++函数(is_palindrome)的逻辑的问题
- C++LinkedList问题.数据类型之间存在冲突?没有匹配的构造函数
- 如何在C++向量中奇数元素前面加上值-1,我在使用insert函数时遇到了问题
- constexpr构造函数需要常量成员函数时出现问题
- 添加存储在向量中的大整数的函数出现问题
- 使用自定义比较函数使用std::sort()对矢量字符串进行排序时出现问题
- 关于 c++ 函数中指针赋值的简单问题
- 如何在标头中声明(或定义)函数的问题
- 有关 c++ 构造函数的问题
- 模板类转换问题 - 无法推断调用的函数
- 从 C++ 中的函数返回数组地址问题
- 关于复制构造函数的一个棘手问题
- 移动赋值运算符;尝试引用已删除的函数.我该如何解决这个问题?
- Arduino:在 loop() 和自定义函数中运行相同的代码时出现问题