QDateTime and Time Zones



  • Hello there,

    In a current development, we were not originally aware that QDateTime takes into account system time zones. When processing large sets of data that are related by time, we began finding our times were an hour off due to the way we set the times (there is a need to having a starting date at the first second of the year, then add seconds to get the desired date/time).

    Now, we have hundreds of references to QDateTime variables that we will need to go through and set to use the UTC time spec. Is there a more "global" way of changing the applications time spec, rather than needing to modify each instantiation of QDateTime objects?

    Thanks!


  • Moderators

    If you're running under Linux (or any POSIXish type system), you can set the environment variable TZ=UTC (if I remember correctly) before running your app.



  • Unfortunately, we are running on Windows...I guess I could just tell users to change their time zone to somewhere without DST ;) I wonder how that would fly!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.