求教怎么获取系统启动到现在过了多久

llg84 2009-12-24 10:49:32
GetTickCount获取的时间不包含系统挂起的时间,这样结果就不正确了,求教该怎么获取从系统启动开始,到现在过了多长时间(包含挂起时间)。
...全文
126 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
guopeixin 2009-12-28
  • 打赏
  • 举报
回复
没仔细看过,应该没有,如果通过修改oal的方式来获取的话,就很easy了
pilixuanke 2009-12-27
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 llg84 的回复:]
引用 7 楼 veabol 的回复:
上层应用就完全不访问底层了?
底层肯定有人做的吧?和那人沟通一下协同处理好这件事不就行了嘛

我是自己做手机应用程序来着,不涉及底层的东西
[/Quote]
如果你们公司不做底层的话,这个功能恐怕难以实现。
博说医械研发 2009-12-24
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 llg84 的回复:]
引用 2 楼 pilixuanke 的回复:
Use GetLocalTime or GetSystemTime to retrieve the current date and time. There is only RTC run when system is suspended, and RTC will update the system time when waked up.

There is no safe way if user changed the system time frequently. You can combine GetTickCount & GetLocalTime to archive your goal, perhaps.

GetLocalTime or GetSystemTime只能获取到当前系统时间,这个时间跟开机没关系,所以应该还是不行,除非能在开机时就获取一个时间并存起来,但作为一个非开机自动运行的程序又做不到这一点。
[/Quote]
你可以在某个驱动或者内核里边等开机完成时获取当前的时间,然后AP通过访问这个时间进行比较
Reallyu 2009-12-24
  • 打赏
  • 举报
回复
没有这种功能,除非自己定制,挂起的时候通过GetLocalTime把时间记录下来,唤醒的时候用当前时间减去挂起时候的时间,记录在内存的某个位置,下次挂起唤醒的时候在算一次,加到上次记录的时间.然后要得到总时间时,用gettickcount+记录的时间
llg84 2009-12-24
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 pilixuanke 的回复:]
Use GetLocalTime or GetSystemTime to retrieve the current date and time. There is only RTC run when system is suspended, and RTC will update the system time when waked up.

There is no safe way if user changed the system time frequently. You can combine GetTickCount & GetLocalTime to archive your goal, perhaps.
[/Quote]
GetLocalTime or GetSystemTime只能获取到当前系统时间,这个时间跟开机没关系,所以应该还是不行,除非能在开机时就获取一个时间并存起来,但作为一个非开机自动运行的程序又做不到这一点。
pilixuanke 2009-12-24
  • 打赏
  • 举报
回复
Use GetLocalTime or GetSystemTime to retrieve the current date and time. There is only RTC run when system is suspended, and RTC will update the system time when waked up.

There is no safe way if user changed the system time frequently. You can combine GetTickCount & GetLocalTime to archive your goal, perhaps.
kyzf 2009-12-24
  • 打赏
  • 举报
回复
MARK,帮顶下,学习下。
arm9linuxpp 2009-12-24
  • 打赏
  • 举报
回复
如果你使用了gettickcount函数,在不睡眠情况下是正常的,但是有睡眠唤醒就没有办法啦
但是在底层是可以实现的!
就是记录每次睡眠时间加在一起就好了
Reallyu 2009-12-24
  • 打赏
  • 举报
回复
CeRunAppAtEvent,NOTIFICATION_EVENT_WAKEUP
可以在应用程序中截获休眠和唤醒的消息
llg84 2009-12-24
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 veabol 的回复:]
上层应用就完全不访问底层了?
底层肯定有人做的吧?和那人沟通一下协同处理好这件事不就行了嘛
[/Quote]
我是自己做手机应用程序来着,不涉及底层的东西
博说医械研发 2009-12-24
  • 打赏
  • 举报
回复
上层应用就完全不访问底层了?
底层肯定有人做的吧?和那人沟通一下协同处理好这件事不就行了嘛
llg84 2009-12-24
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 veabol 的回复:]
引用 3 楼 llg84 的回复:
引用 2 楼 pilixuanke 的回复:
Use GetLocalTime or GetSystemTime to retrieve the current date and time. There is only RTC run when system is suspended, and RTC will update the system time when waked up.

There is no safe way if user changed the system time frequently. You can combine GetTickCount & GetLocalTime to archive your goal, perhaps.

GetLocalTime or GetSystemTime只能获取到当前系统时间,这个时间跟开机没关系,所以应该还是不行,除非能在开机时就获取一个时间并存起来,但作为一个非开机自动运行的程序又做不到这一点。

你可以在某个驱动或者内核里边等开机完成时获取当前的时间,然后AP通过访问这个时间进行比较
[/Quote]
我是做上层应用程序,这样做不太现实吧。。。。。。

19,502

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 嵌入开发(WinCE)
社区管理员
  • 嵌入开发(WinCE)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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