Qt设置windows系统时间

时间:2014-05-16 06:25:00   收藏:0   阅读:861

  Qt设置windows系统时间网上的回答很多,但很少有一步到位的,一般会有8小时时差,下面给出直接解决代码:

  #include "windows.h"

  void Dialog::setTime()
  {
    SYSTEMTIME st;
    GetLocalTime(&st);//关键在这里
    st.wHour=ui->spinBox->value();
    st.wMinute=ui->spinBox_2->value();
    st.wSecond=ui->spinBox_3->value();
    SetLocalTime(&st);
  }

 

Qt设置windows系统时间,布布扣,bubuko.com

原文:http://www.cnblogs.com/Bird-Man/p/3726241.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!