diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2016-05-16 11:22:38 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2016-05-16 11:22:38 (GMT) |
commit | 2f8c5b9aef91ac42874aa06481c0fe2220503c3c (patch) | |
tree | cb7200a4adf18739a2af4c9ebfe313f4593d12ba | |
parent | 42c7d88ffc11651d1fb6b997fd23cc938bce4a39 (diff) | |
parent | 9a2c7bbfb0c53b4532db7280e6804c7ce76d70a3 (diff) | |
download | Doxygen-2f8c5b9aef91ac42874aa06481c0fe2220503c3c.zip Doxygen-2f8c5b9aef91ac42874aa06481c0fe2220503c3c.tar.gz Doxygen-2f8c5b9aef91ac42874aa06481c0fe2220503c3c.tar.bz2 |
Merge branch 'master' of github.com:doxygen/doxygen
-rw-r--r-- | qtools/qdatetime.cpp | 23 | ||||
-rw-r--r-- | qtools/qdatetime.h | 1 | ||||
-rwxr-xr-x | src/util.cpp | 2 |
3 files changed, 25 insertions, 1 deletions
diff --git a/qtools/qdatetime.cpp b/qtools/qdatetime.cpp index d0cc36e..88569f8 100644 --- a/qtools/qdatetime.cpp +++ b/qtools/qdatetime.cpp @@ -1158,6 +1158,29 @@ void QDateTime::setTime_t( uint secsSince1Jan1970UTC ) /*! + Sets the UTC date and time given the number of seconds that have passed + since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC). + + Note that Microsoft Windows supports only a limited range of values for + \a secsSince1Jan1970UTC. +*/ + +void QDateTime::setTimeUtc_t( uint secsSince1Jan1970UTC ) +{ + time_t tmp = (time_t) secsSince1Jan1970UTC; + tm *tM = gmtime( &tmp ); + if ( !tM ) { + d.jd = QDate::greg2jul( 1970, 1, 1 ); + t.ds = 0; + return; + } + d.jd = QDate::greg2jul( tM->tm_year + 1900, tM->tm_mon + 1, tM->tm_mday ); + t.ds = MSECS_PER_HOUR*tM->tm_hour + MSECS_PER_MIN*tM->tm_min + + 1000*tM->tm_sec; +} + + +/*! Returns the datetime as a string. The string format is "Sat May 20 03:40:13 1998". diff --git a/qtools/qdatetime.h b/qtools/qdatetime.h index 2d5869c..010ae73 100644 --- a/qtools/qdatetime.h +++ b/qtools/qdatetime.h @@ -173,6 +173,7 @@ public: void setDate( const QDate &date ) { d=date; } void setTime( const QTime &time ) { t=time; } void setTime_t( uint secsSince1Jan1970UTC ); + void setTimeUtc_t( uint secsSince1Jan1970UTC ); QString toString() const; diff --git a/src/util.cpp b/src/util.cpp index 6d66abd..7624ab9 100755 --- a/src/util.cpp +++ b/src/util.cpp @@ -2582,7 +2582,7 @@ QCString dateToString(bool includeTime) } else // all ok, replace current time with epoch value { - current.setTime_t((ulong)epoch); // TODO: add support for 64bit epoch value + current.setTimeUtc_t((ulong)epoch); // TODO: add support for 64bit epoch value } } return theTranslator->trDateTime(current.date().year(), |