[fpc-devel] New functions for time zone
Michael Van Canneyt
michael at freepascal.org
Wed Jul 11 17:41:45 CEST 2012
On Wed, 11 Jul 2012, José Mejuto wrote:
> Hello FPC,
>
> Wednesday, July 11, 2012, 4:38:19 PM, you wrote:
>
>>> Anyway the functions are nonsense as they accept a parameter for date
>>> to be converted.
> MVC> Not if they have the TZOffset parameter as well.
> MVC> Without this information they are indeed nonsense.
> MVC> That is why I added the parameter.
>
> Well, I undertand it, I was only trying to note that this code:
>
> A:=Now;
> B:=GetLocalTimeOffSet;
> C:=LocalTimeToUniversal(A,B);
>
> Will not return correct result in some mini-mili-microseconds slices
> two times a year, and as more time passes between the assignements of
> A and B (using a time field in databases, it could be days, years,
> months...) the chances of a wrong conversion will raise a lot.
This is correct, but unavoidable without a huge implementation like TZPascal...
Even 'Now' itself is not 100% correct, since lots of computations are still
done after the time was gotten from the OS...
Michael.
More information about the fpc-devel
mailing list