Sign in Join

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

Mailing lists / fpc-pascal / 2009-07

Re: DateTime bug

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

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

Richard Jasmin

Its off by about 8 hrs on unix and the date, um...I get a single digit from the CMOS or whereever for the year.I have to fudge the numbers a little.
Confirmed. Time zone differences are NOT taken into account with FPC for some reason.Instead you get a standard date/time.

It took me a little while to figure out.Mine are off by 8 between Ubuntu and real-mode boot.Real-mode being the more accurate of the two.

Show quoted text 155 lines
Send fpc-pascal mailing list submissions to To subscribe or unsubscribe via the World Wide Web, visit http://lists.freepascal.org/mailman/listinfo/fpc-pascal or, via email, send a message with subject or body 'help' to You can reach the person managing the list at When replying, please edit your Subject line so it is more specific than "Re: Contents of fpc-pascal digest..." Today's Topics: 1. Re: How to use FCGI? (Joost van der Sluis) 2. DateTimeToUnix bug ? (Koenraad Lelong) 3. Re: DateTimeToUnix bug ? (Jonas Maebe) ---------------------------------------------------------------------- Message: 1 Date: Wed, 15 Jul 2009 11:01:29 +0200 From: Joost van der Sluis Subject: Re: [fpc-pascal] How to use FCGI? To: FPC-Pascal users discussions Message-ID: Content-Type: text/plain; charset=UTF-8 Op maandag 13-07-2009 om 11:07 uur [tijdzone +0200], schreef Artur Stuczyński: > OK, thanks, got it working. > > Please correct me, if I am wrong, but this approach makes developing and debugging harder, because it is httpd which spawns the application, so to effectively kill the app and replace it with new build I have to restart the httpd (at least with lighttpd which I tested). > > I see possible resulutions: > > 1. Create the application as a standard CGI and convert it to FCGI on deployment > or > 2. Make TCustomFCGIApplication's descendant and replace WaitForRequest with own code which binds, listens and accepts connections from httpd. Then, upon compilation, I need only to restart my application. > > Am I right? > Easiest is to use the embedded-web-server I've send to this list a month ago. That way you can debug from within the Lazarus-ide. When you deploy your application, you can compile as FastCGI. (Switch one unit in your uses-clausule and you're done) Joost. ------------------------------ Message: 2 Date: Wed, 15 Jul 2009 11:06:39 +0200 From: Koenraad Lelong Subject: [fpc-pascal] DateTimeToUnix bug ? To: Message-ID: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Hi, I have a linux application where I use DatetimeToUnix. I think it contains a bug. Every minute I put a sample in an rrddb (rrdtool). When I dump the rrddb, the time of the samples is 2 hours in the future. Those 2 hours happen to be the time-zone difference, between UTC and CEST. Anyone can verify this ? This is what I used to test this : program DateTest; {$ifdef FPC}{$mode objfpc}{$h+}{$INTERFACES CORBA}{$endif} {$ifdef mswindows}{$apptype console}{$endif} uses {$ifdef FPC}{$ifdef linux}cthreads,{$endif}{$endif} sysutils, dateutils; var Nu : TDateTime; begin Nu:=Now; writeln(nu:1:8,' ',DateTimeToStr(nu),' ',DatetimeToUnix(Nu)); end. When I run "./DateTest && date +%s && date" I get : 40009.44713685 15-7-09 10:43:52 1247654632 1247647432 wo jul 15 10:43:52 CEST 2009 Between the fpc-version and the linux-version of the unix-time there is 7200 seconds difference, fpc running ahead. Is it a bug, or am I missing someting ? This happens with FPC 2.4. Regards, Koenraad Lelong. ------------------------------ Message: 3 Date: Wed, 15 Jul 2009 11:43:53 +0200 From: Jonas Maebe Subject: Re: [fpc-pascal] DateTimeToUnix bug ? To: FPC-Pascal users discussions Message-ID: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes On 15 Jul 2009, at 11:06, Koenraad Lelong wrote: > I have a linux application where I use DatetimeToUnix. I think it > contains a bug. > Every minute I put a sample in an rrddb (rrdtool). When I dump the > rrddb, the time of the samples is 2 hours in the future. Those 2 > hours happen to be the time-zone difference, between UTC and CEST. > DatetimeToUnix is defined as returning the "Unix epoch time corresponding to AValue". So by definition it does not perform any time zone adjustments (which is logical, since there is no information regarding what time zone the input value is related to). It's the same in Delphi (just google for DatetimeToUnix+timezone If you want "now" using the local time zone, use sysutils.getlocaltime instead. Jonas ------------------------------ _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal End of fpc-pascal Digest, Vol 61, Issue 16 ****************************************** ____________________________________________________________________________________ Use the link below to report this message as spam. https://lavabit.com/apps/teacher?sig=651145&key=3466455751 ____________________________________________________________________________________