Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2008-12

Wrong Time from Now() or Time()

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Alexander Bauer

I have a strange problem with fpc 2.2.2 on Ubuntu Linux. The function Now(); did not return the right time ?!? It returns the time UTC - 6 hours.

Any suggestions ?

br,
Alex

Reply by email

Valdas Jankūnas
to Alexander Bauer

Alexander Bauer rašė:

Show quoted text 8 lines
I have a strange problem with fpc 2.2.2 on Ubuntu Linux. The function Now(); did not return the right time ?!? It returns the time UTC - 6 hours. Any suggestions ? br, Alex

try GetTime or GetLocalTime from SysUtils unit.

Valdas Jankūnas

Reply by email

Alexander Bauer
to Valdas Jankūnas
Show quoted text 14 lines
Alexander Bauer rašė: > I have a strange problem with fpc 2.2.2 on Ubuntu Linux. > The function Now(); did not return the right time ?!? > It returns the time UTC - 6 hours. > > Any suggestions ? > > br, > Alex try GetTime or GetLocalTime from SysUtils unit.

It's always the same time. UTC - 6 hours.
But it's not a problem of fpc or the functions, it must be a problem of the Linux Ditribution.

On Ubuntu 8.04 Desktop the time is correct.
I use a system based on Ubuntu Server 8.04 and get a wrong time.

Does someone know what system components are relevant for the time functions ?
Perhaps the system i use has something missing.

Btw. the linux date command shows the correct time, of course.

Alex

Reply by email

Graeme Geldenhuys
to Alexander Bauer
Alexander Bauer wrote 6 lines
It's always the same time. UTC - 6 hours. But it's not a problem of fpc or the functions, it must be a problem of the Linux Ditribution. On Ubuntu 8.04 Desktop the time is correct. I use a system based on Ubuntu Server 8.04 and get a wrong time.

We have an Ubuntu Server 8.04. I did a quick test, and the result of Now() was correct.

cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=8.04
DISTRIB_CODENAME=hardy
DISTRIB_DESCRIPTION="Ubuntu 8.04"

uname -a
Linux argon 2.6.24-21-generic #1 SMP Mon Aug 25 16:57:51 UTC 2008 x86_64 GNU/Linux

./timetest
4-12-08 09:55:13

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Alexander Bauer

I found the problem for the the wrong time.
I checked /etc/localtime and this was ok, but there was also a file /etc/timezone with a wrong entry !

fpc seems to first checks the /etc/timezone and then /etc/localtime

Kylix, and also all other programs i've tested do it in the different order!

br,
Alex

Show quoted text 47 lines
Hi; Have you checked what time zone you have set up? V. On Thursday 04 December 2008, you wrote: > Valdas Jankūnas schrieb: > >> Alexander Bauer rašė: >> >>> I have a strange problem with fpc 2.2.2 on Ubuntu Linux. >>> The function Now(); did not return the right time ?!? >>> It returns the time UTC - 6 hours. >>> >>> Any suggestions ? >>> >>> br, >>> Alex >>> >> try GetTime or GetLocalTime from SysUtils unit. >> > It's always the same time. UTC - 6 hours. > But it's not a problem of fpc or the functions, it must be a problem of > the Linux Ditribution. > > On Ubuntu 8.04 Desktop the time is correct. > I use a system based on Ubuntu Server 8.04 and get a wrong time. > > Does someone know what system components are relevant for the time > functions ? > Perhaps the system i use has something missing. > > Btw. the linux date command shows the correct time, of course. > > Alex > > > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-pascal >

Reply by email