r7 - 06 Jul 2007 - 18:15:14 - PeterThoenyYou are here: TWiki >  Support Web > TimeStampAlways20MinBehind
Tags:
, create new tag

Question

Hi,

Whether I use the gmtime or the servertime, the timestamp on revisions and attachments are always 20 mins behind. The same time is used in the log files.

Can anybody think of why this might be?

# date
Thu May 10 09:41:41 BST 2007
# tail -f log200705.txt
| 10 May 2007 - 09:20 | AndrewJones | view | Main.WebHome |  | 10.1.11.106 |

Thanks,
Andrew

Environment

TWiki version: TWikiRelease04x01x02
TWiki plugins:  
Server OS: RedHat? Linux
Web server: Apache
Perl version:  
Client OS:  
Web Browser:  
Categories: Platform, Version control, System logs, Statistics
-- AndrewRJones - 10 May 2007

Answer

ALERT! If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.

Perhaps the server is in Nepal? wink

Seriously, though, it sounds like the time is wrong on your server.

-- CrawfordCurrie - 14 May 2007

Re-opening this question. From the user post (date 09:41:41 BST 2007 and log entry 10 May 2007 - 09:20) it looks like the log time does not match the system time. I have no idea how that can happen.

-- PeterThoeny - 15 May 2007

We still cannot work this one out. Has anybody got any pointers?

-- AndrewRJones - 31 May 2007

Are you sure you didn't view Webomhe 2 minutes ago? wink

-- GrazianoMisuraca - 01 Jun 2007

The exact code use to print the log is:

        $time = TWiki::Time::formatTime( time(), undef, 'servertime' );

        if( open( FILE, ">>$log" ) ) {
            print FILE "| $time | $message\n";
            close( FILE );
TWiki::Time::formatTime does this for servertime
        ( $sec, $min, $hour, $day, $mon, $year, $wday ) =
          localtime( $epochSeconds );
Now, for the time to be off by 20 mins, one of two things has to happen; Either, iff you are using MAIN, you have defined a $TWiki::cfg{DefaultDateFormat} that has 20 instead of $min, or more likely since you see the same effect on timestamps, something is wrong with either time or localtime. time() and =localtime are fundamental perl functions. You can check their behaviour on the server as follows:
$ date
$ perl -e 'print join(";", localtime(time()),"\n";
The fields are (from perldoc localtime) $sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst (BST)

I still think the clock is probably wrong on your server, myself.

-- CrawfordCurrie - 02 Jun 2007

Sorry, closing this after more than 30 days of inactivity...

-- PeterThoeny - 06 Jul 2007

 
Change status to:
Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r7 < r6 < r5 < r4 < r3 | More topic actions
 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback SourceForge.net Logo