Skip to content

Commit

Permalink
QTimeZone::utc()
Browse files Browse the repository at this point in the history
  • Loading branch information
pifopi committed Dec 4, 2024
1 parent 0e7ead3 commit 32141c6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Common/Qt/TimeQt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ WallClock parse_utc_time_str(const std::string& str){
throw ParseException("Invalid time.");
}

QDateTime qdatetime(qdate, qtime, Qt::UTC);
QDateTime qdatetime(qdate, qtime, QTimeZone::utc());
int64_t secs_since_epoch = qdatetime.toSecsSinceEpoch();

return WallClock{} + std::chrono::seconds(secs_since_epoch);
Expand All @@ -154,12 +154,12 @@ WallClock parse_utc_time_str(const std::string& str){
int64_t to_seconds_since_epoch(const DateTime& date){
QDate qdate(date.year, date.month, date.day);
QTime qtime(date.hour, date.minute, date.second);
QDateTime qdatetime(qdate, qtime, Qt::UTC);
QDateTime qdatetime(qdate, qtime, QTimeZone::utc());
int64_t secs_since_epoch = qdatetime.toSecsSinceEpoch();
return secs_since_epoch;
}
DateTime from_seconds_since_epoch(int64_t seconds_since_epoch){
QDateTime qdatetime = QDateTime::fromSecsSinceEpoch(seconds_since_epoch, Qt::UTC);
QDateTime qdatetime = QDateTime::fromSecsSinceEpoch(seconds_since_epoch, QTimeZone::utc());
QDate qdate = qdatetime.date();
QTime qtime = qdatetime.time();
return DateTime{
Expand Down

0 comments on commit 32141c6

Please sign in to comment.