[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Date function


> Yes but no. :-)
>
> It's more complex than that.
>
> The Gambas "Date" is actually an UTC timestamp. It's a number of
> milliseconds since a fixed epoch which is assumed to be midnight in UTC.
>
> When converting that timestamp to a date string representation, a pseudo
> Gregorian calendar is used.
>
> It's "pseudo" because:
>
> - It is extended in the past before its invention.
>
> - The real calendar used nowadays is not exactly Gregorian, as it
> sometimes adds one leap second in some years to minimize the difference
> with the Sun movement in the sky relatively to the Earth.
>
> This leap second is normally taken into account by Linux if you
> synchronize your clock with NTP.
>
> But it occurs unexpectedly as far as I know. The Linux kernel maintains
> a boolean that tells if an extra second will be added at the end of the
> current day.
>
> That random leap second prevents Gambas from doing accurate arithmetic
> with dates. So Gambas ignores that, and its date representation do not
> match the modern Gregorian calendar dates.
>
> The only date/time that is ensured by Linux to be accurate when
> converted to its string representation is what the 'Now()' function
> returnsl.
>

Sure, but wouldn't that be accurate enough?
I have never considered values in seconds between some dates to be
accurate. Amazingly, even climate change makes a tiny contribution to the
rotation speed of the Earth.
When the glaciers melt the mass of water is distributed closer to the
equator and due to conservation of momentum Earth must rotate a bit slower.
Of course earthquakes, changes in the Earth core, etc contribute much more
to it, but still.


Jussi

References:
Date functionGianluigi <gradobag@xxxxxxxxxxx>
Re: Date functionJussi Lahtinen <jussi.lahtinen@xxxxxxxxx>
Re: Date functionBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Re: Date functionJussi Lahtinen <jussi.lahtinen@xxxxxxxxx>
Re: Date functionBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Re: Date functionJussi Lahtinen <jussi.lahtinen@xxxxxxxxx>
Re: Date functionJussi Lahtinen <jussi.lahtinen@xxxxxxxxx>
Re: Date functionBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>