SID-01824: WebChanges calculates incorrect topic age
| Status: |
Answered |
TWiki version: |
6.0.0 |
Perl version: |
This is perl, v5.10.0 built for i686-linux-thread-multi |
| Category: |
CategoryLocalization |
Server OS: |
Ubuntu Linux |
Last update: |
10 years ago |
We just installed TWiki-6.0.0, Mon, 14 Oct 2013, build 26523 on a system running Ubuntu linux. As usual after an upgrade I test things by modifying some topics to make sure everything works as expected. I now notice in the WebChanges topic that the items I just updated mere minutes ago show that they were updated 8 hours ago. So the formula that's calculating the age is off by 8 hours (I'm in Pacific time zone); I'm guessing the calculation is using GMT, and is not correctly adjusting for time zone.
(Also, as an aside, I notice that when I do a search right here in the Support web at TWiki.org, the "Last Update" column in the search results page shows
every topic as having been updated 0 minutes ago. So you folks apparently have your own issues related to date/time calculations)
--
Barry Lake - 2013-11-15
Discussion and Answer
Thanks for pointing out the issue with
Support.WebSearch, is fixed now. Was an issue with missing initialization.
Not sure why your
WebChanges have an offset of 8 hours. We tested TWiki-6 on different platforms and it works as expected, regardless of timezone of the server.
--
Peter Thoeny - 2013-11-15
Look at the raw text of
TWiki06x00.WebChanges. It first initializes the current time:
%CALCULATE{$SET(now, $TIME())}%
Then in the format it calculates the time difference, shown here with expanded
$percnt:
%CALCULATE{$SET(epoch, $TIME($date GMT))$FORMATTIMEDIFF(min, 1, $TIMEDIFF($GET($epoch), $GET($now), minute))}% ago
I see there is actually a small bug. The
$GET() variable retrieval should be against
epoch and
now instead of
$epoch and
$now:
%CALCULATE{$SET(epoch, $TIME($date GMT))$FORMATTIMEDIFF(min, 1, $TIMEDIFF($GET(epoch), $GET(now), minute))}% ago
Not sure if this causes the issue. Can you check?
--
Peter Thoeny - 2013-11-15
I just checked, the
SpreadSheetPlugin's
$SET() and
$GET() filter out any non-alphanumeric characters, so this should have no effect.
--
Peter Thoeny - 2013-11-15
I changed $epoch and $now to epoch and now in data/TWiki/WebChanges.txt, but it made no difference.
--
Barry Lake - 2013-11-15
I changed the "format" option to "formatx" in TWiki/data/WebChanges.txt in my TWiki. That accomplished two things:
- Causes WebChanges to display the date/time of the last revision instead of a calculated age, which I preferred anyway;
- Therefore, since we're no longer calculating the revision's age, it doesn't matter if the age is (or was) being calculated incorrectly.
The underlying problem is not solved, of course, but I don't care now, because I have it looking the way I want. (Of course, every time I update to a new version of TWiki I'll have to remember this custom hack. But that's Ok, because I already do that with several other hacks, so I'll just add this one to my checklist.)
--
Barry Lake - 2013-11-16
We are experiencing a similar problem. It appears that any pages modified after January this year are listed as last being changed '44 years ago'. I've confirmed that the epoch times embedded in the twiki pages are correct. Since the calculation is broken I've disabled it but any pointers on what to check next would be appreciated.
--
Ben Hall - 2014-06-26
Not sure Ben. 44 years ago is 1970, the start of the Unix epoch time. This indicates that the spreadsheet calculation gets epoch 0 for topic dates. Wondering why. Do you see the proper change date displayed at the bottom of topics?
--
Peter Thoeny - 2014-06-26
Closing this question after more than 30 days of inactivity. Feel free to reopen if needed. Consider engaging one of the
TWiki consultants if you need timely help. We invite you to
get involved with the community, it is more likely you get community support if you support the open source project!
--
Peter Thoeny - 2015-12-03
We recently upgraded to the latest version (TWiki-6.0.2, Sun, 29 Nov 2015, build 29687, Plugin API version 6.02), and I noticed that the WebChanges topic's display of modify date/times has reverted to the "N days ago" or "N months ago" format. So I had to implement once again the hack I described on 2013-11-16; namely, to change "format" to "formatx" in the WebChanges.txt file, thereby disabling the new format, so that actual dates and times display, which I prefer.
I'm wondering... rather than simply impose a new format on all TWiki users whether they like it or not, wouldn't it be better to give us the option to choose the new behavior, via a new WebPreferences setting? Just sayin'
--
Barry Lake - 2016-01-04
Good point Barry on customizable age format. Any TWiki community member can supply a patch or
sponsor a new feature.
--
Peter Thoeny - 2016-01-05
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.