Skip to content

Conversation

@dennwc
Copy link
Contributor

@dennwc dennwc commented Oct 6, 2025

This is a proposal to clarify usage of the mono package. The change adds some basic docs as well as some extra API and deprecations.

A few proposed changes:

  • Document that using time.Now() is fine, there's no need to use mono.Now(). Go's time is already monotonic.
  • Use time.Now() directly in mono.Now(). There shouldn't be a need for getting relative time from the reference.
  • Discourage direct use of mono.FromTime. Introduce mono.Unix(sec,ns) and mono.Parse instead. Most non-monotonic timestamps come from these two functions.

In addition, we should probably add a static check to CI for core and media repos to catch remaining usages of time.Unix and time.Parse. These must be updated to corresponding mono function calls. This should be easier than tracking down all non-monotonic timestamps across the codebase.

@dennwc dennwc requested review from boks1971 and paulwe October 6, 2025 18:02
@dennwc dennwc self-assigned this Oct 6, 2025
@changeset-bot
Copy link

changeset-bot bot commented Oct 6, 2025

🦋 Changeset detected

Latest commit: 8c7fa05

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

💥 An error occurred when fetching the changed packages and changesets in this PR
Some errors occurred when validating the changesets config:
The package or glob expression "github.com/livekit/protocol" specified in the `fixed` option does not match any package in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch.

Copy link
Contributor

@boks1971 boks1971 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! Good call on doing a sweep for time.Unix and time.Parse usage

@dennwc dennwc merged commit 5901371 into main Oct 14, 2025
10 checks passed
@dennwc dennwc deleted the mono-docs branch October 14, 2025 13:49
This was referenced Oct 14, 2025
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.

3 participants