Repository navigation
Cast TimeSpan, TimeOnly and a time with its offset through the MEOS parts - #69
Merged
estebanzimanyi merged 1 commit intoNov 14, 2026
Conversation
…arts MEOSConvert, which tools/objectgen.py generates, gains the casts of the three time types left: an interval and a TimeSpan through interval_to_parts and interval_from_parts, its whole days as days and the rest as microseconds; a time and a TimeOnly through time_to_parts and time_from_parts; a time with time zone and the pair of a TimeOnly and its offset through timetz_to_parts and timetz_from_parts, .NET holding a time with an offset in no single type. An interval with months, or beyond the range of a TimeSpan, the clock 24:00:00, a tick below a microsecond and an offset below a second are refused with ArgumentOutOfRangeException. The casts of the six types are public, as JMEOS's ConversionUtils and GoMEOS's casts are, so MEOS.NET casts every time type the other bindings cast. Why: every binding holds the same casts of the six time types of MEOS, each the generated wrapper of the MEOS conversion and the constructor of the host, refusing what the host cannot state. Witness: ToTimeSpan of '2 days 03:00:00.5' answers 2.03:00:00.5 and of '1 mon 2 days' raises; ToInterval of 36 hours answers '1 day 12:00:00'; ToTimeOnly of '24:00:00' raises; ToTimeWithOffset of '13:45:30+02' answers 13:45:30 and +02:00, which ToTimetzADT writes back as '13:45:30+02'. Measured: dotnet test passes 117 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.
MEOSConvert, which tools/objectgen.py generates, gains the casts of the
three time types left: an interval and a TimeSpan through
interval_to_parts and interval_from_parts, its whole days as days and the
rest as microseconds; a time and a TimeOnly through time_to_parts and
time_from_parts; a time with time zone and the pair of a TimeOnly and its
offset through timetz_to_parts and timetz_from_parts, .NET holding a time
with an offset in no single type. An interval with months, or beyond the
range of a TimeSpan, the clock 24:00:00, a tick below a microsecond and an
offset below a second are refused with ArgumentOutOfRangeException. The
casts of the six types are public, as JMEOS's ConversionUtils and GoMEOS's
casts are, so MEOS.NET casts every time type the other bindings cast.
Why: every binding holds the same casts of the six time types of MEOS,
each the generated wrapper of the MEOS conversion and the constructor of
the host, refusing what the host cannot state.
Witness: ToTimeSpan of '2 days 03:00:00.5' answers 2.03:00:00.5 and of
'1 mon 2 days' raises; ToInterval of 36 hours answers '1 day 12:00:00';
ToTimeOnly of '24:00:00' raises; ToTimeWithOffset of '13:45:30+02'
answers 13:45:30 and +02:00, which ToTimetzADT writes back as
'13:45:30+02'.
Measured: dotnet test passes 117 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.