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


9248
9249
9250
# File 'Monkeybrains.rb', line 9248

def dst
  @dst
end

hourToybox::Lang::Number

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

Returns:

Since:

  • 1.0.0


9253
9254
9255
# File 'Monkeybrains.rb', line 9253

def hour
  @hour
end

minToybox::Lang::Number

The minute of the current hour.

Returns:

Since:

  • 1.0.0


9258
9259
9260
# File 'Monkeybrains.rb', line 9258

def min
  @min
end

secToybox::Lang::Number

The second of the current minute.

Returns:

Since:

  • 1.0.0


9263
9264
9265
# File 'Monkeybrains.rb', line 9263

def sec
  @sec
end

timeZoneOffsetToybox::Lang::Number

The time offset from UTC in seconds.

Returns:

Since:

  • 1.0.0


9268
9269
9270
# File 'Monkeybrains.rb', line 9268

def timeZoneOffset
  @timeZoneOffset
end