mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Bug
- Fixed bug where ISO dates were parsed and the TZ was modified, which should have no bearing on a Zulu time.
This commit is contained in:
parent
dd73cc1ccf
commit
2c07837852
3 changed files with 15 additions and 21 deletions
|
@ -18,6 +18,8 @@ Bugs
|
||||||
Uli Martens).
|
Uli Martens).
|
||||||
+ Fixed bug where '6 months' was interpreted as 180 days, but when rendered
|
+ Fixed bug where '6 months' was interpreted as 180 days, but when rendered
|
||||||
was shown as '5 months' (thanks to Aikido Guy).
|
was shown as '5 months' (thanks to Aikido Guy).
|
||||||
|
+ Fixed bug where ISO dates were parsed and the TZ was modified, which should
|
||||||
|
have no bearing on a Zulu time.
|
||||||
|
|
||||||
------ old releases ------------------------------
|
------ old releases ------------------------------
|
||||||
|
|
||||||
|
|
|
@ -131,13 +131,13 @@ Date::Date (const std::string& input, const std::string& format /* = "m/d/Y" */)
|
||||||
if (isRelativeDate (input))
|
if (isRelativeDate (input))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Parse an ISO date.
|
// Parse a formatted date.
|
||||||
Nibbler n (input);
|
Nibbler n (input);
|
||||||
if (n.getDateISO (_t) && n.depleted ())
|
if (n.getDate (format, _t) && n.depleted ())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Parse a formatted date.
|
// Parse an ISO date.
|
||||||
if (n.getDate (format, _t) && n.depleted ())
|
if (n.getDateISO (_t) && n.depleted ())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Perhaps it is an epoch date, in string form?
|
// Perhaps it is an epoch date, in string form?
|
||||||
|
|
|
@ -701,17 +701,9 @@ bool Nibbler::getDateISO (time_t& t)
|
||||||
tms.tm_hour = hour;
|
tms.tm_hour = hour;
|
||||||
tms.tm_min = minute;
|
tms.tm_min = minute;
|
||||||
tms.tm_sec = second;
|
tms.tm_sec = second;
|
||||||
|
tms.tm_gmtoff = 0;
|
||||||
|
|
||||||
char *tz = getenv ("TZ");
|
t = timegm (&tms);
|
||||||
setenv ("TZ", "UTC", 1);
|
|
||||||
tzset ();
|
|
||||||
t = mktime (&tms);
|
|
||||||
if (tz)
|
|
||||||
setenv ("TZ", tz, 1);
|
|
||||||
else
|
|
||||||
unsetenv ("TZ");
|
|
||||||
tzset();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue