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


9505
9506
9507
# File 'Monkeybrains.rb', line 9505

def dst
  @dst
end

hourToybox::Lang::Number

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

Returns:

Since:

  • 1.0.0


9510
9511
9512
# File 'Monkeybrains.rb', line 9510

def hour
  @hour
end

minToybox::Lang::Number

The minute of the current hour.

Returns:

Since:

  • 1.0.0


9515
9516
9517
# File 'Monkeybrains.rb', line 9515

def min
  @min
end

secToybox::Lang::Number

The second of the current minute.

Returns:

Since:

  • 1.0.0


9520
9521
9522
# File 'Monkeybrains.rb', line 9520

def sec
  @sec
end

timeZoneOffsetToybox::Lang::Number

The time offset from UTC in seconds.

Returns:

Since:

  • 1.0.0


9525
9526
9527
# File 'Monkeybrains.rb', line 9525

def timeZoneOffset
  @timeZoneOffset
end