Skip to content

feat!: use gleam_time internally for Time representation#54

Open
tylerbutler wants to merge 2 commits intomassivefermion:mainfrom
tylerbutler:feat/gleam-time-internal-migration
Open

feat!: use gleam_time internally for Time representation#54
tylerbutler wants to merge 2 commits intomassivefermion:mainfrom
tylerbutler:feat/gleam-time-internal-migration

Conversation

@tylerbutler
Copy link
Contributor

Summary

  • Migrates birl's internal representation to use gleam_time as the foundation
  • Bumps version to 2.0.0 for breaking changes
  • Updates CI to use Gleam 1.11, OTP 27, and ubuntu-22.04

Breaking Changes

  • Time type now uses timestamp.Timestamp and time_duration.Duration internally
  • TimeOfDay.milli_second field renamed to nanosecond (now stores nanoseconds)
  • unix_epoch changed from constant to function: unix_epoch()

New Features

  • Added get_milli_second() deprecated helper for TimeOfDay backward compatibility
  • Added NanoSecond to duration.Unit enum
  • Added duration.nano_seconds() constructor
  • Added gleam_time interop functions:
    • to_gleam_timestamp() / from_gleam_timestamp()
    • to_unix_nano() / from_unix_nano()
    • get_offset_duration()
  • Added duration interop:
    • to_gleam_duration() / from_gleam_duration()

FFI Changes

  • Removed: now(), local_offset(), to_parts(), from_parts() (now provided by gleam_time)
  • Kept: monotonic_now(), weekday(), local_timezone() (not provided by gleam_time)

Test Plan

  • All 22 tests pass on Erlang target
  • All 22 tests pass on JavaScript target
  • CI passes via act -j test
  • gleam format --check src test passes

BREAKING CHANGES:
- Time type now uses timestamp.Timestamp and time_duration.Duration internally
- TimeOfDay.milli_second field renamed to nanosecond (now stores nanoseconds)
- unix_epoch changed from constant to function: unix_epoch()

New features:
- Added get_milli_second() deprecated helper for TimeOfDay backward compatibility
- Added NanoSecond to duration.Unit enum
- Added duration.nano_seconds() constructor
- Added gleam_time interop: to_gleam_timestamp(), from_gleam_timestamp(),
  to_unix_nano(), from_unix_nano(), get_offset_duration()
- Added duration interop: to_gleam_duration(), from_gleam_duration()

FFI changes:
- Removed now(), local_offset(), to_parts(), from_parts() (now provided by gleam_time)
- Kept monotonic_now(), weekday(), local_timezone() (not provided by gleam_time)

Version bumped to 2.0.0 for breaking changes.
@tylerbutler tylerbutler mentioned this pull request Feb 4, 2026
@tylerbutler tylerbutler marked this pull request as ready for review February 8, 2026 21:43
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