python - python: using ctypes.windll.kernel32.GetTickCount64 to get uptime gives negative result
问题描述
I'm trying to get the uptime of a windows machine using ctypes.windll.kernel32.GetTickCount64. I'm not sure what it's giving me though, I thought it was supposed to be the number of ticks since the systems started in milliseconds. It seems to be a negative number which is going down though. I read somewhere that it's an unsigned int, but it seems like a regular int to me.
import ctypes
import time
for _ in range(10):
print ctypes.windll.kernel32.GetTickCount64()
time.sleep(1)
-1514476171
-1514475171
-1514474156
-1514473156
-1514472156
-1514471156
-1514470156
-1514469156
-1514468156
-1514467140
How can I convert this value to get an uptime in seconds? Or is there a better way to get this information?
解决方案
推荐阅读
- swift - 有没有办法压缩这条 if->cast 行?
- visual-studio-code - 如何在 Windows 系统上远程编辑文件
- excel - 根据一个单元格跳过特定行中的excel宏
- mongodb - 创建父文档时未初始化子文档。Nestjs/猫鼬
- rest - 休息服务是否应该将包含 id 的实体返回给其他实体或实体本身?
- java - 位置搜索 ItemClick 数组列表
- maven - 如何在Jenkinsfile中将工件发布版本动态解析为参数defaultValue
- php - 邮件 - 在收到的电子邮件中可见 \r\n 个字符
- r - 减少 Rmd PDF 中 ggplot 和标题之间的空白
- ncurses - xterm 在原始输入上报告错误的转义序列