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);
  }

 

相关文章:

  • 2021-11-17
  • 2021-12-15
  • 2021-12-15
  • 2021-12-24
  • 2021-11-02
  • 2022-03-06
猜你喜欢
  • 2022-02-13
  • 2022-12-23
  • 2021-12-05
  • 2022-12-23
  • 2021-10-10
相关资源
相似解决方案