Repository navigation
Cast DateTime and DateOnly through the MEOS conversions - #68
Merged
estebanzimanyi merged 2 commits intoNov 14, 2026
Merged
Conversation
…yDB master tools/codegen.py and tools/objectgen.py over the catalog of MobilityDB master b49672e545 (MEOS-API c13560a8a7): the functions layer gains the MEOS conversions of the time types, timestamp_to_unix_us, unix_us_to_timestamp, date_to_unix_days, unix_days_to_date, interval_to_parts, interval_from_parts, time_to_parts, time_from_parts, timetz_to_parts and timetz_from_parts, with the ever and always overlaps of the temporal types and boxes and the box restrictions of the temporal cells; the object layer gains their methods. GAP-LEDGER.md records the functions still left to the raw binding. Measured: dotnet build MEOS.NET.sln -c Release prints 0 warnings, 0 errors; dotnet test passes 106 tests, 0 failing, 0 skipped, and the ExampleApp smoke run exits 0, against libmeos of the same master.
MEOSConvert, which tools/objectgen.py generates, casts a timestamptz through timestamptz_to_unix_us and unix_us_to_timestamptz, a timestamp through timestamp_to_unix_us and unix_us_to_timestamp, and a date through date_to_unix_days and unix_days_to_date, in place of the text of TimestamptzOut, TimestamptzIn, DateOut and DateIn. A DateTime of UTC or local kind is a timestamptz at its instant; one of unspecified kind is read in the zone of the MEOS session through timestamp_to_timestamptz, as MEOS reads a timestamp without an offset. A tick below a microsecond is refused with ArgumentOutOfRangeException, and a value the other side cannot state is refused by the constructor of DateTime or DateOnly. A MEOS Timestamp maps to its own pair, ToTimestamp and ToUnzonedDateTime, where the object layer sent it through the timestamptz cast. ExampleApp drops the ticks below a microsecond of DateTime.UtcNow before it makes an instant. Why: a binding casts to the types of its host through the conversions of MEOS, never through text or arithmetic of its own; the text wrote six digits of a fraction, dropping the seventh of a tick, and ToUniversalTime read a DateTime of unspecified kind in the zone of the machine. Witness: TFloatInst.Make(1.0, 2001-01-01 00:00 of unspecified kind) answers a start of 2000-12-31 23:00 UTC on a Europe/Brussels machine with the session in UTC, and now 2001-01-01 00:00 UTC; a moment of .1234565 s answered .123456 s, and now raises. Measured: TimeCastTests fails 2 of its 5 tests on main (the tick is dropped, the unspecified moment is an hour off) and passes all 5 here; dotnet test passes 111 tests, 0 failing, 0 skipped, under TZ=UTC and TZ=Europe/Brussels; dotnet build prints 0 warnings; the ExampleApp smoke run exits 0; against libmeos of MobilityDB master b49672e545.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Regenerate the functions and types layers from the catalog of MobilityDB master
tools/codegen.py and tools/objectgen.py over the catalog of MobilityDB
master b49672e545 (MEOS-API c13560a8a7): the functions layer gains the
MEOS conversions of the time types, timestamp_to_unix_us,
unix_us_to_timestamp, date_to_unix_days, unix_days_to_date,
interval_to_parts, interval_from_parts, time_to_parts, time_from_parts,
timetz_to_parts and timetz_from_parts, with the ever and always overlaps
of the temporal types and boxes and the box restrictions of the temporal
cells; the object layer gains their methods. GAP-LEDGER.md records the
functions still left to the raw binding.
Measured: dotnet build MEOS.NET.sln -c Release prints 0 warnings, 0
errors; dotnet test passes 106 tests, 0 failing, 0 skipped, and the
ExampleApp smoke run exits 0, against libmeos of the same master.
Cast DateTime and DateOnly through the MEOS conversions
MEOSConvert, which tools/objectgen.py generates, casts a timestamptz
through timestamptz_to_unix_us and unix_us_to_timestamptz, a timestamp
through timestamp_to_unix_us and unix_us_to_timestamp, and a date
through date_to_unix_days and unix_days_to_date, in place of the text of
TimestamptzOut, TimestamptzIn, DateOut and DateIn. A DateTime of UTC or
local kind is a timestamptz at its instant; one of unspecified kind is
read in the zone of the MEOS session through timestamp_to_timestamptz, as
MEOS reads a timestamp without an offset. A tick below a microsecond is
refused with ArgumentOutOfRangeException, and a value the other side
cannot state is refused by the constructor of DateTime or DateOnly. A
MEOS Timestamp maps to its own pair, ToTimestamp and ToUnzonedDateTime,
where the object layer sent it through the timestamptz cast. ExampleApp
drops the ticks below a microsecond of DateTime.UtcNow before it makes an
instant.
Why: a binding casts to the types of its host through the conversions of
MEOS, never through text or arithmetic of its own; the text wrote six
digits of a fraction, dropping the seventh of a tick, and ToUniversalTime
read a DateTime of unspecified kind in the zone of the machine.
Witness: TFloatInst.Make(1.0, 2001-01-01 00:00 of unspecified kind)
answers a start of 2000-12-31 23:00 UTC on a Europe/Brussels machine with
the session in UTC, and now 2001-01-01 00:00 UTC; a moment of
.1234565 s answered .123456 s, and now raises.
Measured: TimeCastTests fails 2 of its 5 tests on main (the tick is
dropped, the unspecified moment is an hour off) and passes all 5 here;
dotnet test passes 111 tests, 0 failing, 0 skipped, under TZ=UTC and
TZ=Europe/Brussels; dotnet build prints 0 warnings; the ExampleApp smoke
run exits 0; against libmeos of MobilityDB master b49672e545.