Results 1 to 4 of 4

Thread: How to change Linux system clock by Qt

  1. #1
    Join Date
    Nov 2008
    Posts
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default How to change Linux system clock by Qt

    Hello

    I want to change set Linux's system clock, I ever tried QDateTime, but the setDate and setTime are not effect.

    Thank you

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to change Linux system clock by Qt

    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: How to change Linux system clock by Qt

    I ever tried QDateTime, but the setDate and setTime are not effect.
    From the documentation:
    Sets the time part of this datetime to time.
    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/

  4. #4
    Join Date
    Nov 2008
    Posts
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to change Linux system clock by Qt

    Thank you very much !

Similar Threads

  1. Linux - Support system's theme change
    By agarny in forum Qt Programming
    Replies: 2
    Last Post: 10th July 2011, 16:12
  2. How to change computer's Clock and Date
    By anafor2004 in forum Newbie
    Replies: 1
    Last Post: 24th October 2009, 15:18
  3. How to change the date and time of a system
    By augusbas in forum Qt Programming
    Replies: 1
    Last Post: 23rd June 2009, 05:55
  4. How to change system DateTime?
    By FreePascal in forum Qt Programming
    Replies: 8
    Last Post: 5th April 2008, 14:50
  5. How to change system menu of window?
    By krivenok in forum Qt Programming
    Replies: 1
    Last Post: 27th January 2006, 15:19

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.