转换蜱time_t的或FILETIME() [英] convert ticks to time_t or Filetime()
本文介绍了转换蜱time_t的或FILETIME()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何转换蜱time_t的或FILETIME()?
How do I convert ticks to time_t or filetime()?
推荐答案
time_t的
是的定义为秒从Unix纪元日期1970年1月1日@ 00:00 UTC数。所以,你基本上需要弄清楚你的蜱多少时间再present和减去时代的时间。下面应该这样做。
time_t
is defined as the number of seconds from the Unix epoch date January 1, 1970 @ 00:00 UTC. So, you basically need to figure out how much time your ticks represent and subtract the epoch time. The following should do it.
double GetTimeTSecondsFrom(long ticks)
{
DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
return (new DateTime(ticks) - epoch).TotalSeconds;
}
这篇关于转换蜱time_t的或FILETIME()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文