Strange, date and touch returning different times.

Hi guys,

Hope one of you guys can sort this out for me.

I first noticed this when users were uploading files from our website to our server and the time uploaded was +18 hours ahead of the current time. At first I assumed this was an issue with the coding, but didn't think it was likely as we are using moodle, which gets tested thoroughly.

After going through the actual moodle source code and seeing how the timestamp was generated I noticed it used the php function filemtime.

I then shelled into the server and typed out the command date, which returned the correct date. I then did touch test.txt and noticed that the modified date (using ls -l) for test.txt was 18 hours ahead, which lead me to believe that it wasn't anything to do with Moodle but the unix server itself.

The server is running Ubuntu 8.04.

If you need anymore information please let me know.

Thanks.

Timezone, UTC used, NTP ? Who else has root access ? Ubuntu version ?

Hi Sysgate,

Thanks for your reply.

Below are the comments to your questions.

1) Timezone - /usr/share/zoneinfo/Australia/Brisbane

Like I said earlier, using date returns the correct time.

2) This is the output I received typing date then - Fri Apr 9 11:48:52 EST 2010 - UTC is EST. Is that what you were after? (I am no unix guru, I am a software engineer helping a client - not a system administrator)

3) I have read https://help.ubuntu.com/8.04/serverguide/C/NTP.html and not sure how this relates, as the time returned from date is correct, which uses NTP - doesn't it? I will suggest to the client that they add a cron job to run 'ntpdate ntp.ubuntu.com'.

4) Not sure - I was given a support account - which has given me permissions to create new files and browse. Do different users have different time configurations? The www-data user (web browser) is adding +18 hours to the time as well when a file is uploaded.

5) DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=8.04
DISTRIB_CODENAME=hardy
DISTRIB_DESCRIPTION="Ubuntu 8.04.2"

Regards,

Mark.

---------- Post updated at 09:13 PM ---------- Previous update was at 09:06 PM ----------

Also, I should add a quote I found when researching this issue on Linux Tips - Linux, Clocks, and Time - however we are not running Red Hat which is the distro the articles states that is affected - we however did follow the articles suggestion and created a symbolic link.

"..
The time in some applications is wrong

If some applications (such as date) display the correct time, but others don't, and you are running Red Hat Linux 5.0 or 5.1, you most likely have run into a bug caused by a move of the timezone information from /usr/lib/zoneinfo to /usr/share/zoneinfo. The fix is to create a symbolic link from /usr/lib/zoneinfo to /usr/share/zoneinfo: ``ln -s ../share/zoneinfo /usr/lib/zoneinfo''.
.."