Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )

Advanced DNS Management
New ZoneEdit. New Managment.


Sign Up Now
Reply to this topicStart new topic
> Epoch Time, Tricky time problem
post Nov 29 2002, 08:19 AM
Post #1

Whats this Lie-nix Thing?

Group: Members
Posts: 3
Joined: 29-November 02
Member No.: 205


I have several machines including redhat, trustix and freeBSD and I am having the same problem on them all. When I ask for epoch time in php and mysql it tells me Jan first 1970 at 01:00

now as i understand it epoch time is Jan first 00:00
hwclock is set to utc and is correct
timezone is set (using /etc/localtime symlinked to /usr/share/zoneinfo/Europe/London) to GMT and is correct
I am in the UK (GMT) and it is NOT summer (not BST) and last I looked Jan is not in summer either

I get the following output to php date command...
[david@oasis ~]# php
print(date("d-M-y H:i:s",0));

X-Powered-By: PHP/4.2.2
Content-type: text/html

01-Jan-70 01:00:00

and mysql untixtime command...
[david@oasis ~]# mysql -p -e 'SELECT FROM_UNIXTIME(0);'
Enter password:
| 1970-01-01 01:00:00 |

I have also done a test in perl like so...
[david@oasis ~]# perl -e '$t = localtime(0);print $t,"n";'
Thu Jan 1 01:00:00 1970
[david@oasis ~]# perl -e '$t = gmtime(0);print $t,"n";'
Thu Jan 1 00:00:00 1970

Note that perl seems to think localtime is 1 hour behind, yet if I use the same code to ask for the current time they both return the same time...
[david@oasis ~]# perl -e '$t = localtime();print $t,"n";'
Fri Nov 29 13:29:08 2002
[david@oasis ~]# perl -e '$t = gmtime();print $t,"n";'
Fri Nov 29 13:29:16 2002

Please help, this is driving me insane
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:


RSS Lo-Fi Version Time is now: 24th June 2018 - 04:01 PM