Time start = Clock.now;
Thread.sleep(0.150);
Stdout.formatln("slept for {} ms", (Clock.now-start).millis);
long ticks = myTimeSpan.ticks; TimeSpan copyOfMyTimeSpan = TimeSpan(ticks);
| t | A TimeSpan value to add |
| t | A TimeSpan value to add |
| t | A TimeSpan to subtract |
| t | A TimeSpan to subtract |
| v | A multiplier to use for scaling this time span. |
| v | A multipler to use for scaling |
| v | A divisor to use for scaling this time span. |
| v | A multipler to use for dividing |
| t | A divisor used for dividing |
| long value | The number of nanoseconds. |
| long value | The number of microseconds. |
| long value | The number of milliseconds. |
| long value | The number of seconds. |
| long value | The number of minutes. |
| long value | The number of hours. |
| long value | The number of days. |
| value | The interval to convert in seconds. |
long ticks = myTime.ticks;
Time copyOfMyTime = Time(ticks);
| value | A Time value. |
| t | A TimeSpan value. |
| t | A TimeSpan value. |
| t | A TimeSpan value. |
| t | A Time value. |
| t | A TimeSpan value. |
auto unixTime = Clock.now.unix.seconds;
auto javaTime = Clock.now.unix.millis;
auto time = Clock.now.time;
assert (time.millis < 1000);
assert (time.seconds < 60);
assert (time.minutes < 60);
assert (time.hours < 24);
You can create a TimeOfDay from an existing Time or TimeSpan instance
via the respective time() method. To convert back to a TimeSpan, use
the span() method| uint hours | number of hours since midnight |
| uint minutes | number of minutes into the hour |
| uint seconds | number of seconds into the minute |
| uint millis | number of milliseconds into the second |
auto tod = TimeOfDay(100, 100, 100, 10000); assert(tod.hours == 100); assert(tod.minutes == 100); assert(tod.seconds == 100); assert(tod.millis == 10000);
| long ticks | ticks representing a Time value. This is normalized so that it represent a time of day (modulo-24 etc) |