using Toybox.System as Sys;
using Toybox.WatchUi as Ui;
using Toybox.Time as Time;
using Toybox.Time.Gregorian as Gregorian;
using Toybox.Graphics as Gfx;
class TestWatchFace extends Ui.WatchFace
{
function initialize() {
}
function onUpdate(dc) {
dc.setColor(Gfx.COLOR_BLACK, Gfx.COLOR_BLACK);
dc.clear();
var font = Gfx.FONT_LARGE;
var ty = dc.getFontHeight(font);
var cx = dc.getWidth() / 2;
var cy = dc.getHeight() / 2;
cy -= ty;
dc.setColor(Gfx.COLOR_GREEN, Gfx.COLOR_TRANSPARENT);
var times = [
Time.now(),
Time.today(),
Time.today().add(new Time.Duration(-Sys.getClockTime().timeZoneOffset))
];
for (var i = 0; i != times.size(); ++i) {
var time = Gregorian.info(times, Time.FORMAT_SHORT);
Sys.println(Lang.format("$1$: $2$", [ i, times.value() ]));
var text = Lang.format("$1$:$2$:$3$", [
time.hour.format("%02d"),
time.min.format("%02d"),
time.sec.format("%02d")
]);
dc.drawText(cx, cy, font, text, Gfx.TEXT_JUSTIFY_CENTER | Gfx.TEXT_JUSTIFY_VCENTER);
cy += ty;
}
}
}
[/code]
I ran this code and captured the following on the console...
Shell Version 0.1.0
0: 1432269608
1: 1432252800
2: 1432278000
According to http://www.epochconverter.com/, those timestamp values are equal to...
0: 5/22/2015 04:40:08 GMT, 21:40:08 PM GMT-7:00 DST
1: 5/22/2015 00:00:00 GMT, 5:00:00 PM GMT-7:00 DST
2: 5/22/2015 07:00:00 GMT, 12:00:00 AM GMT-7:00 DST