Skip to content

Commit

Permalink
Merge branch 'master' of github.com:doxygen/doxygen
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimitri van Heesch committed May 16, 2016
2 parents 42c7d88 + 9a2c7bb commit 2f8c5b9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
23 changes: 23 additions & 0 deletions qtools/qdatetime.cpp
Expand Up @@ -1157,6 +1157,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.
Expand Down
1 change: 1 addition & 0 deletions qtools/qdatetime.h
Expand Up @@ -173,6 +173,7 @@ class Q_EXPORT QDateTime
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;

Expand Down
2 changes: 1 addition & 1 deletion src/util.cpp
Expand Up @@ -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(),
Expand Down

0 comments on commit 2f8c5b9

Please sign in to comment.