Skip to content

Commit

Permalink
Fix DST handling in DateTime conversion (#292)
Browse files Browse the repository at this point in the history
The field tm_isdst needs to be set to a negative value for mktime to
apply the local daylight saving time rules.
  • Loading branch information
janh committed Jan 8, 2022
1 parent 9ab640a commit 0f4af58
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions mtp/ptp/ObjectFormat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ namespace mtp
time_t ConvertDateTime(const std::string &timespec)
{
struct tm time = {};
time.tm_isdst = -1;
char *end = strptime(timespec.c_str(), "%Y%m%dT%H%M%S", &time);
if (!end)
return 0;
Expand Down

0 comments on commit 0f4af58

Please sign in to comment.