Skip to content

Cast TimeSpan, TimeOnly and a time with its offset through the MEOS parts - #69

Merged
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:fix/time-casts-all-types
Nov 14, 2026
Merged

estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:fix/time-casts-all-types

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

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.

…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.
@estebanzimanyi
estebanzimanyi merged commit f4ddc8f into MobilityDB:main Nov 14, 2026
1 check passed
@estebanzimanyi
estebanzimanyi deleted the fix/time-casts-all-types branch November 14, 2026 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant