Class: Toybox::System::ClockTime

Inherits:
Lang::Object show all

Overview

Represents the current local time.

ClockTime is a convenient way to get the current time in an easy-to-use format without the need to perform time zone conversions or time-based arithmetic. Values provided by ClockTime may require formatting for proper display within an app.

Examples:

Get the time and print it to the console

using Toybox.System;
var myTime = System.getClockTime(); // ClockTime object
System.println(
    myTime.hour.format("%02d") + ":" +
    myTime.min.format("%02d") + ":" +
    myTime.sec.format("%02d")
);

See Also:

Since:

  • 1.0.0

Instance Attribute Summary collapse

Method Summary

Methods inherited from Lang::Object

equals, hashCode, method, toString, weak

Instance Attribute Details

dstToybox::Lang::Number

The daylight savings time offset.

Returns:

Since:

  • 1.0.0



9004
9005
9006
# File 'Monkeybrains.rb', line 9004

def dst
  @dst
end

hourToybox::Lang::Number

The hour of the day based on a 24-hour clock.

Returns:

Since:

  • 1.0.0



9009
9010
9011
# File 'Monkeybrains.rb', line 9009

def hour
  @hour
end

minToybox::Lang::Number

The minute of the current hour.

Returns:

Since:

  • 1.0.0



9014
9015
9016
# File 'Monkeybrains.rb', line 9014

def min
  @min
end

secToybox::Lang::Number

The second of the current minute.

Returns:

Since:

  • 1.0.0



9019
9020
9021
# File 'Monkeybrains.rb', line 9019

def sec
  @sec
end

timeZoneOffsetToybox::Lang::Number

The time offset from UTC in seconds.

Returns:

Since:

  • 1.0.0



9024
9025
9026
# File 'Monkeybrains.rb', line 9024

def timeZoneOffset
  @timeZoneOffset
end