From: konrad Date: Sun, 11 Jul 2010 11:26:47 +0000 (+0000) Subject: add convenience method to get "now" X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=262da44da7e6b079c3878791a6a5d8a830503b58;p=konrad%2Ftzone.git add convenience method to get "now" git-svn-id: https://silmor.de/svn/softmagic/tzone/trunk@554 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- diff --git a/tzdata.h b/tzdata.h index af66b32..0bd1667 100644 --- a/tzdata.h +++ b/tzdata.h @@ -265,6 +265,13 @@ class TimeStamp static TimeStamp fromDateTime(int year,quint8 month,quint8 day,quint8 hour,quint8 minute,quint8 second,bool isLocal=true) {return fromDateTime(QDate(year,month,day),QTime(hour,minute,second),isLocal);} + /**returns the current date/time as localized time stamps + \param zone the name of the target time zone*/ + static TimeStamp now(QString zone){return TimeStamp(QDateTime::currentDateTime().toTime_t(),zone);} + /**returns the current date/time as time stamp + \param isLocal if true the timestamp will be in the default time zone, if false on UTC*/ + static TimeStamp now(bool isLocal=true){return TimeStamp(QDateTime::currentDateTime().toTime_t(),isLocal);} + /**sets the global search repository for time zones, this only affects time zones that have not been loaded yet*/ static void setSearchPath(const QStringList&);