Skip to content
zNotChill edited this page Sep 13, 2025 · 1 revision

Blossom provides utilities for managing time very simply.

You can use any number type (float, double, int, long...) to convert a number to a TimeSpan.

Longhand names are exposed as property getters:

  • millis
  • ticks
  • seconds
  • minutes
  • hours
  • days

Shorthand names are exposed as function getters:

  • ms()
  • t()
  • s()
  • m()
  • h()
  • d()

All of these, no matter shorthand or longhand, return a Time class, containing conversion options, as detailed below.

You can convert a Time class to a Duration class using Time#duration.

Time Example

val ms = 500.ms()
ms.ticks // returns Time(10, TimeSpan.TICK)
ms.seconds // returns Time(10, TimeSpan.SECOND)

val ms = 500.millis
ms.ticks // returns Time(10, TimeSpan.TICK)
ms.seconds // returns Time(10, TimeSpan.SECOND)

// ALTERNATIVELY, you can choose to convert manually:
val hours = 5.hours
hours.convertTo(TimeSpan.SECOND) // returns Time(18000, TimeSpan.SECOND)

Clone this wiki locally