Sign in Join

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

Mailing lists / fpc-pascal / 2008-04

function now shows bad date (-2 hours)

4 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

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

Dusan Halicky

Hi.

I have this simple demo (in ubuntu, using fpc 2.2.0, locale is sk_SK.utf8):

program test;
uses SysUtils;
begin
  writeln(DateTimeToStr(now));
end.

When I compile it and run it it print 13:44:

$ ./test
6-4-08 13:44:32

But the actual date is 15:44:

$ date
Ne apr  6 15:44:35 CEST 2008

What's wrong?

Reply by email

Marco van de Voort
to Dusan Halicky
Show quoted text 19 lines
I have this simple demo (in ubuntu, using fpc 2.2.0, locale is sk_SK.utf8): program test; uses SysUtils; begin writeln(DateTimeToStr(now)); end. When I compile it and run it it print 13:44: $ ./test 6-4-08 13:44:32 But the actual date is 15:44: $ date Ne apr 6 15:44:35 CEST 2008 What's wrong?

I assume that the problem is that your main clock is set to GMT, so then you have 1 hour timezone + 1 hour summer time difference.

IOW, you need to correct that result for time differences.

Reply by email

Dusan Halicky
to Marco van de Voort

Is there any function which gives me local time depending on system locale settings?

I assume that the problem is that your main clock is set to GMT, so then you have 1 hour timezone + 1 hour summer time difference. IOW, you need to correct that result for time differences.

Reply by email

T. Guilleminot

Got same issue. Problem on was my BIOS clock which were not at the correct time. This was hidden by the OS which showed correct hour (wrong timezone).

Tom

Reply by email