驱动中打印系统时间

编程入门 行业动态 更新时间:2024-10-27 12:35:27

  1. 在驱动中打印本地时间三个步骤:
  2. 1、在驱动中调用KeQuerySystemTime获取GMT系统时间

  3. 2、调用ExSystemTimeToLocalTime将GMT系统时间转换为本地系统时间

  4. 3、调用RtlTimeToTimeFields将本地时间转换为TIME_FIELDS结构体

  5. TIME_FIELDS结构体定义如下:

  6. typedef struct _TIME_FIELDS {
  7.     CSHORT Year; // range [1601...]
  8.     CSHORT Month; // range [1..12]
  9.     CSHORT Day; // range [1..31]
  10.     CSHORT Hour; // range [0..23]
  11.     CSHORT Minute; // range [0..59]
  12.     CSHORT Second; // range [0..59]
  13.     CSHORT Milliseconds;// range [0..999]
  14.     CSHORT Weekday; // range [0..6] == [Sunday..Saturday]
  15. } TIME_FIELDS;
  16. typedef TIME_FIELDS *PTIME_FIELDS;


  17. 实现如下:

  18. CHAR szTime[128];
  19. LARGE_INTEGER systemTime, localTime;

  20. TIME_FIELDS timeField;
  21. KeQuerySystemTime(&systemTime)

  22. ExSystemTimeToLocalTime(&systemTime, &localTime);

  23. RtlTimeToTimeFields(&localTime, &timeField);

  24. sprintf("%d-%02d-%02d %02d:%02d:%02d:%03d",timeField.Year, timeField.Month, timeField.Day, timeField.Hour, timeField.Minute, timeField.Second, timeField.Milliseconds)
http://blog.csdn/eric_zl_zhang/article/details/6780786
<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script> 阅读(294) | 评论(0) | 转发(0) | 0

上一篇:_beginthread, _beginthreadex (windows crt

下一篇:C2275 illegal use of this type as an expression

相关热门文章
  • Python 包管理工具解惑
  • Red Hat Linux 的主要系统目录...
  • APP开发报价单,如何计算APP报...
  • app开发需要多少钱
  • 操作系统虚拟内存中的四种典型...
  • LNK1123: 转换到 COFF 期间失...
  • WIN7访问共享:0x80070035 找不...
  • Delphi 2010下载+完美破解...
  • vs2010调试C++程序时提示 无...
  • VISIO,不规则封闭图形填充方...
  • linux dhcp peizhi roc
  • 关于Unix文件的软链接
  • 求教这个命令什么意思,我是新...
  • sed -e "/grep/d" 是什么意思...
  • 谁能够帮我解决LINUX 2.6 10...
给主人留下些什么吧!~~ 评论热议

更多推荐

驱动中打印系统时间

本文发布于:2023-06-14 04:33:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1438082.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:时间   系统

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!