[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Date function
[Thread Prev] | [Thread Next]
- Subject: Re: Date function
- From: Jussi Lahtinen <jussi.lahtinen@xxxxxxxxx>
- Date: Thu, 6 Nov 2025 03:09:28 +0200
- To: user@xxxxxxxxxxxxxxxxxxxxxx
> 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
| Date function | Gianluigi <gradobag@xxxxxxxxxxx> |
| Re: Date function | Jussi Lahtinen <jussi.lahtinen@xxxxxxxxx> |
| Re: Date function | Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx> |
| Re: Date function | Jussi Lahtinen <jussi.lahtinen@xxxxxxxxx> |
| Re: Date function | Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx> |
| Re: Date function | Jussi Lahtinen <jussi.lahtinen@xxxxxxxxx> |
| Re: Date function | Jussi Lahtinen <jussi.lahtinen@xxxxxxxxx> |
| Re: Date function | Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx> |