17位时间戳怎么处理

但是GV但是 2015-04-24 09:47:26
我在一个SQLite数据库中发现时间戳都是17位
麻烦帮我转换成Unix时间戳
下面是这个时间戳对应的北京时间
23948589432569856 2015/3/27 17:06:06
23953910578282496 2015/3/31 09:07:22
谢谢
...全文
1883 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
赵4老师 2015-04-27
  • 打赏
  • 举报
回复
纠正楼上: 23948589432569856 2015/3/27 17:06:06 23953910578282496 2015/3/31 09:07:22 23953910578282496-23948589432569856=5321145712640 2015/3/31 09:07:22-2015/3/27 17:06:06=316876(秒) 5321145712640/316876=16792517.302162360039889420467312(次/秒) 有哪个标准是每秒计数约16792517.302162360039889420467312次的?
赵4老师 2015-04-27
  • 打赏
  • 举报
回复
23948589432569856 2015/3/27 17:06:06 23953910578282496 2015/3/31 09:07:22 23953910578282496-23948589432569856=5321145712640 2015/3/31 09:07:22-2015/3/27 17:06:06=316878(秒) 5321145712640/316878=16792411.314890904385915084038652(次/秒) 有哪个标准是每秒计数16792411.314890904385915084038652次的?
yangyunzhao 2015-04-25
  • 打赏
  • 举报
回复
我记得时间戳有两个标准,常用的是32位数字记录1970年到现在的秒,精度秒。 还有一个很不常用的标准,用64位数字,记录15**年到现在的微妙,精度微妙。不知道是不是这个?
一根烂笔头 2015-04-24
  • 打赏
  • 举报
回复

#include <time.h>
#include <stdio.h> 
#include <stdlib.h> 

int main(int argc, char *argv[])
{
	time_t tm = 1429878888;
	printf("%s\n", ctime(&tm));
	exit(0);
}
结果就是现在 Fri Apr 24 20:34:48 2015
一根烂笔头 2015-04-24
  • 打赏
  • 举报
回复
你这是什么时间戳,unix当前时间戳没这么大 当前unix的时间戳:1429878888,打完这几个字又加上几秒
但是GV但是 2015-04-24
  • 打赏
  • 举报
回复
引用 1 楼 zhao4zhong1 的回复:
https://www.baidu.com/s?wd=sqlite%20时间戳转日期
我在stackoverflow上看到18位的时间戳转换,下面是一个人这么答复的 It looks to me like it's based at 1970 (the Unix epoch) instead of 1900, with 256000000 "ticks" per second. I haven't seen such a format before, but it seems to check out - for example, using Noda Time: class Test { static void Main() { Console.WriteLine(ToInstant(362087323333655740)); } static Instant ToInstant(long value) { // We don't have to truncate to milliseconds, but it's simple for now... long millis = value / 256000; return Instant.FromMillisecondsSinceUnixEpoch(millis); } } Output: 2014-10-27T09:53:26Z ... which would correspond to 2014-10-27T15:23:26 as the local time in India. 来自楼主了哈:::他这个也把处理的思想给出来了,我这个时间戳我实在是没有一点头绪,麻烦赵老师和各位看到的高手给指点一下,谢谢了

65,180

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧