[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-commits-diffs] net.venge.monotone: f7cea8d4e635f311b8c85257b8b
From: |
code |
Subject: |
[Monotone-commits-diffs] net.venge.monotone: f7cea8d4e635f311b8c85257b8bfbaf38b961407 |
Date: |
Tue, 9 Oct 2012 19:42:30 +0200 (CEST) |
revision: f7cea8d4e635f311b8c85257b8bfbaf38b961407
date: 2012-10-09T18:47:08
author: Richard Hopkins <address@hidden>
branch: net.venge.monotone
changelog:
Make 'expand_date' always return a date string in UTC
This was found as perfoming a commit and then `mtn log -r"l:5 minutes ago"`
would return no matches instead of the just committed revision; tested in
the UK which is currently 1 hour ahead of UTC.
The problem was we were returning a local time value which was then compared
against the UTC value stored in the database. To fix always return a UTC
time from 'expand_date'. I've also updated the logging line to say the date
has been expanded to UTC format for clarity.
However, we could do with a test for this. I tried adding the
`mtn log -r"l:5 minutes ago"` case to 'check_later_and_earlier_selectors'
but the test still passed even though it fails in a terminal; this is because
the tests always run in UTC mode.
manifest:
format_version "1"
new_manifest [d86f6d36163608b9dc65d12b602b1f0c2c6a01f1]
old_revision [a141532508113260b6e1831a2c9e946d9dee21c4]
patch "src/selectors.cc"
from [19a82c64f44ab5433354299f84598174cb15f510]
to [3fe6662223cd5a5f539189be93cf6652f9374acf]
patch "src/std_hooks.lua"
from [a7dccd332679e3669d0c02e90922692277ba06e3]
to [5b089162751bf675605aa10655c77dcd7af99b93]
============================================================
--- src/selectors.cc 19a82c64f44ab5433354299f84598174cb15f510
+++ src/selectors.cc 3fe6662223cd5a5f539189be93cf6652f9374acf
@@ -169,7 +169,7 @@ string preprocess_date_for_selector(stri
if (sel != tmp)
{
- P(F("expanded date '%s' -> '%s'") % sel % tmp);
+ P(F("expanded date '%s' to UTC -> '%s'") % sel % tmp);
sel = tmp;
}
if (equals && sel.size() < 19)
============================================================
--- src/std_hooks.lua a7dccd332679e3669d0c02e90922692277ba06e3
+++ src/std_hooks.lua 5b089162751bf675605aa10655c77dcd7af99b93
@@ -1006,21 +1006,21 @@ function expand_date(str)
if str == "now"
then
local t = os.time(os.date('!*t'))
- return os.date("%Y-%m-%dT%H:%M:%S", t)
+ return os.date("!%Y-%m-%dT%H:%M:%S", t)
end
-- today don't uses the time # for xgettext's sake, an extra quote
if str == "today"
then
local t = os.time(os.date('!*t'))
- return os.date("%Y-%m-%d", t)
+ return os.date("!%Y-%m-%d", t)
end
-- "yesterday", the source of all hangovers
if str == "yesterday"
then
local t = os.time(os.date('!*t'))
- return os.date("%Y-%m-%d", t - 86400)
+ return os.date("!%Y-%m-%d", t - 86400)
end
-- "CVS style" relative dates such as "3 weeks ago"
@@ -1038,9 +1038,9 @@ function expand_date(str)
local t = os.time(os.date('!*t'))
if trans[type] <= 3600
then
- return os.date("%Y-%m-%dT%H:%M:%S", t - (n * trans[type]))
+ return os.date("!%Y-%m-%dT%H:%M:%S", t - (n * trans[type]))
else
- return os.date("%Y-%m-%d", t - (n * trans[type]))
+ return os.date("!%Y-%m-%d", t - (n * trans[type]))
end
end
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Monotone-commits-diffs] net.venge.monotone: f7cea8d4e635f311b8c85257b8bfbaf38b961407,
code <=