From 262da44da7e6b079c3878791a6a5d8a830503b58 Mon Sep 17 00:00:00 2001 From: konrad Date: Sun, 11 Jul 2010 11:26:47 +0000 Subject: [PATCH] add convenience method to get "now" git-svn-id: https://silmor.de/svn/softmagic/tzone/trunk@554 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- tzdata.h | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) 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&); -- 1.7.2.5