Hello
I want to change set Linux's system clock, I ever tried QDateTime, but the setDate and setTime are not effect.
Thank you
Hello
I want to change set Linux's system clock, I ever tried QDateTime, but the setDate and setTime are not effect.
Thank you
Changing system date requires superuser privileges. Qt has no facilities to modify system date, as far as I know. You can call date through QProcess if you want. Maybe also some interface for modifying date and time is exposed in dbus.
From the documentation:I ever tried QDateTime, but the setDate and setTime are not effect.
Those are setters for the QDateTime object, not the system values. I think you will need to use system api. You can for example use QProcess to call "date" command on linux. More here: howto-set-date-time-from-linux-command-prompt/Sets the time part of this datetime to time.
Thank you very much !
Bookmarks