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


10811
10812
10813
# File 'Monkeybrains.rb', line 10811

def dst
  @dst
end

hourToybox::Lang::Number

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

Returns:

Since:

  • 1.0.0


10816
10817
10818
# File 'Monkeybrains.rb', line 10816

def hour
  @hour
end

minToybox::Lang::Number

The minute of the current hour.

Returns:

Since:

  • 1.0.0


10821
10822
10823
# File 'Monkeybrains.rb', line 10821

def min
  @min
end

secToybox::Lang::Number

The second of the current minute.

Returns:

Since:

  • 1.0.0


10826
10827
10828
# File 'Monkeybrains.rb', line 10826

def sec
  @sec
end

timeZoneOffsetToybox::Lang::Number

The time offset from UTC in seconds.

Returns:

Since:

  • 1.0.0


10831
10832
10833
# File 'Monkeybrains.rb', line 10831

def timeZoneOffset
  @timeZoneOffset
end