summaryrefslogtreecommitdiff
path: root/source/MazarineView.mc
blob: 725b5d99e88682d33330dbef82f3696afd0ef125 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
// Mazarine
//
// Copyright (C) 2019 cy384, 2020-2022 cos
// All rights reserved.
//
// This software may be modified and distributed under the terms
// of the BSD license. See the LICENSE file for details.

using Toybox.WatchUi;
using Toybox.Graphics;
using Toybox.System;
using Toybox.Math;
using Toybox.Application;
using Toybox.Time;
using Toybox.Time.Gregorian;
using Toybox.SensorHistory;
using Toybox.Lang;

class MazarineView extends WatchUi.WatchFace {
    var background;
    var width_minute_mark = 3;

    function initialize() {
        WatchUi.WatchFace.initialize();
    }

    function onLayout(_) { }

    function onShow() { }

    function draw_root_window(dc) {
        var width = dc.getWidth();
        var height = dc.getHeight();

        dc.setColor(Graphics.COLOR_BLACK, Graphics.COLOR_TRANSPARENT);
        dc.fillRectangle(0, 0, width, height);
        dc.setColor(Graphics.COLOR_LT_GRAY, Graphics.COLOR_TRANSPARENT);

        var min;
        if (width > height) {
            min = height;
        } else {
            min = width;
        }

        var iX, iY, oX, oY;
        var furtherOuterRad = min * 0.46;
        var outerRad = min * 0.48;
        var innerRad = min * 0.52;

        dc.setColor(Graphics.COLOR_LT_GRAY, Graphics.COLOR_TRANSPARENT);

        // minute marks
        dc.setPenWidth(width_minute_mark);
        for (var x = 0; x <= 60; x += 1) {
            var angle = x * (Math.PI / 30.0);

            // make the 5 minute marks longer
            if (x % 5 == 0) {
                oX = width/2.0 + Math.sin(angle)*furtherOuterRad;
                oY = height/2.0 + Math.cos(angle)*furtherOuterRad;
            } else {
                oX = width/2.0 + Math.sin(angle)*outerRad;
                oY = height/2.0 + Math.cos(angle)*outerRad;
            }

            iX = width/2.0 + Math.sin(angle)*innerRad;
            iY = height/2.0 + Math.cos(angle)*innerRad;

            dc.drawLine(iX, iY, oX, oY);
        }
    }

    function draw_battery_meter(dc) {
        var width = dc.getWidth();
        var height = dc.getHeight();

        var stats = System.getSystemStats();
        var battery_meter_width = 30;
        var battery_meter_height = 5;
        // var battery_meter_x = 1.0 * width/5.0 - battery_meter_width/2.0;
        // var battery_meter_y = height/2.0 - battery_meter_height/2.0;
        var battery_meter_x = width/2.0 - battery_meter_width/2.0;
        var battery_meter_y = 7.0 * height/8.0 - battery_meter_height/2.0;
        dc.setPenWidth(1);
        dc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_BLACK);
        dc.drawRectangle(battery_meter_x - 1, battery_meter_y - 1,
            battery_meter_width + 2, battery_meter_height + 2);
        if (stats.battery < 25.0) {
            dc.setColor(Graphics.COLOR_RED, Graphics.COLOR_BLACK);
        } else {
            dc.setColor(Graphics.COLOR_LT_GRAY, Graphics.COLOR_TRANSPARENT);
        }
        dc.fillRectangle(battery_meter_x, battery_meter_y,
            battery_meter_width * stats.battery/100.0, battery_meter_height);
    }

    function draw_timezone(dc, index, name, offset) {
        var width = dc.getWidth();
        var height = dc.getHeight();
        var font = Graphics.FONT_XTINY;
        var x_pos = 1.0 * width/4.0;
        // var x_pos = 1.0 * width/2.0;
        // var y_pos = height/2.0-dc.getFontHeight(font)/2.0;
        var y_pos = height/2.0-dc.getFontHeight(font)*2.5+index *
            dc.getFontHeight(font);
        // var y_pos = height/3.0-dc.getFontHeight(font)/2.0;
        // now ⇒ Toybox::Time::Moment
        var now = Time.now();
        var dur = new Time.Duration(offset * Gregorian.SECONDS_PER_HOUR);
        // add(offset * duration) ⇒ Toybox::Time::Moment
        var when = now.add(dur);
        var time = Gregorian.utcInfo(when, Time.FORMAT_MEDIUM);
        // utcInfo(moment, format) ⇒ Toybox::Time::Gregorian::Info
        // var time = Time.Moment(Time.now(), Time.FORMAT_MEDIUM);

        dc.setColor(Graphics.COLOR_LT_GRAY, Graphics.COLOR_TRANSPARENT);
        dc.drawText(x_pos, y_pos, font, name + " " + time.hour.format("%02d") +
            ":" + time.min.format("%02d"), Graphics.TEXT_JUSTIFY_CENTER);
    }

    function draw_temperature(dc) {
        var width = dc.getWidth();
        var height = dc.getHeight();
        var font = Graphics.FONT_XTINY;
        var x_pos = 1.0 * width/4.0;
        var y_pos = height/2.0-dc.getFontHeight(font)/2.0;

        dc.setColor(Graphics.COLOR_LT_GRAY, Graphics.COLOR_TRANSPARENT);
        dc.drawText(x_pos, y_pos, font, Toybox.SensorHistory
            .getTemperatureHistory({}).next().data
            .format("%.1d") + "°C", Graphics.TEXT_JUSTIFY_CENTER);
    }

    function draw_timezones(dc) {
        var today = Gregorian.info(Time.now(), Time.FORMAT_SHORT);
        var weekday;
        weekday = today.day_of_week - 1;

        var past_first_sunday = (today.day - weekday) > 0;
        var past_second_sunday = (today.day > 7) && (today.day - weekday > 7);

        draw_utc_offset(dc);
        draw_timezone(dc, 1, "HK", 8);
        // draw_timezone(dc, 3, "ACDT", 10.5);

        // https://en.wikipedia.org/wiki/Time_in_Australia
        //  "first Sunday in October	first Sunday in April"
        if ((today.month > 4 && today.month < 10) ||
            (today.month == 4 && past_first_sunday ) ||
            (today.month == 10 && !past_first_sunday ))
        {
            draw_timezone(dc, 2, "NSW", 10);
        } else {
            draw_timezone(dc, 2, "NSW", 11);
        }

        // https://en.wikipedia.org/wiki/Daylight_saving_time_in_the_United_States
        //  "In the U.S., daylight saving time starts on the second Sunday in
        //   March and ends on the first Sunday in November"
        if ((today.month > 3 && today.month < 11) ||
            (today.month == 3 && past_second_sunday ) ||
            (today.month == 11 && !past_first_sunday ))
        {
            draw_timezone(dc, 3, "NY", -4);
            draw_timezone(dc, 4, "CA", -7);
        } else {
            draw_timezone(dc, 3, "NY", -5);
            draw_timezone(dc, 4, "CA", -8);
        }
    }

    function draw_utc_offset(dc) {
        var width = dc.getWidth();
        var height = dc.getHeight();
        var font = Graphics.FONT_XTINY;
        var x_pos = 1.0 * width/2.0;
        var y_pos = 1.0 * height/4.0-dc.getFontHeight(font)/2.0;
        var myTime = System.getClockTime();
        var tz_string = "UTC ";

        dc.setColor(Graphics.COLOR_LT_GRAY, Graphics.COLOR_TRANSPARENT);
        if ( myTime.timeZoneOffset/3600 >= 0 ) {
            tz_string += "+";
        }
        tz_string += myTime.timeZoneOffset/3600;
        if ( myTime.timeZoneOffset % 3600 ) {
            tz_string += ":" + myTime.timeZoneOffset / 60 % 60;
        }
        dc.drawText(x_pos, y_pos, font, tz_string,
            Graphics.TEXT_JUSTIFY_CENTER);
    }

    function draw_dayday(dc) {
        var width = dc.getWidth();
        var height = dc.getHeight();
        var today = Gregorian.info(Time.now(), Time.FORMAT_MEDIUM);
        var clockTime = System.getClockTime();
        var minute_hand_obscures = false;
        var hour_hand_obscures = false;
        var dayday_font = Graphics.FONT_XTINY;
        var x_pos = 3.0 * width/4.0;
        var y_pos = height/2.0-dc.getFontHeight(dayday_font)/2.0;

        if (clockTime.hour % 12 == 2 and clockTime.min >= 35) {
            hour_hand_obscures = true;
        }

        if (clockTime.hour % 12 == 3 and clockTime.min <= 35) {
            hour_hand_obscures = true;
        }

        if (clockTime.min >= 14 and clockTime.min <= 17) {
            minute_hand_obscures = true;
        }

        if ( minute_hand_obscures ) {
            if ( clockTime.hour % 12 == 2 ) {
                y_pos += 1.5 * dc.getFontHeight(dayday_font);
            } else {
                y_pos -= 1.5 * dc.getFontHeight(dayday_font);
            }
        } else if ( hour_hand_obscures ) {
            if ( clockTime.min > 15 && clockTime.min < 30 ) {
                y_pos -= 1.5 * dc.getFontHeight(dayday_font);
            } else {
                y_pos += 1.5 * dc.getFontHeight(dayday_font);
            }
        }

        dc.setColor(Graphics.COLOR_LT_GRAY, Graphics.COLOR_TRANSPARENT);
        dc.drawText(x_pos, y_pos, dayday_font, today.day_of_week + " " +
            today.day, Graphics.TEXT_JUSTIFY_CENTER);
    }

    function draw_digital_time(dc) {
        var width = dc.getWidth();
        var height = dc.getHeight();
        var time_font = Graphics.FONT_LARGE;
        var x_pos = width/2.0;
        var y_pos = 4*height/5.0-dc.getFontHeight(time_font)/2.0;
        var clockTime = System.getClockTime();

        dc.setColor(Graphics.COLOR_LT_GRAY, Graphics.COLOR_TRANSPARENT);
        dc.drawText(x_pos, y_pos, time_font, clockTime.hour.format("%02d") +
            ":" + clockTime.min.format("%02d"), Graphics.TEXT_JUSTIFY_CENTER);
    }

    function draw_minute_hand(dc) {
        var width = dc.getWidth();
        var height = dc.getHeight();

        var min;
        if (width > height) {
            min = height;
        } else {
            min = width;
        }

        var clockTime = System.getClockTime();

        var hourRad = min * 0.18;
        var pointerOut = min * 0.45;
        var pointerIn = min * 0.00;

        // get the angle for minutes
        var angle = (clockTime.min / 60.0) * (-2.0 * Math.PI);
        angle += Math.PI;

        // points for the hour nub
        var pox = width/2.0 + Math.sin(angle)*pointerOut;
        var poy = height/2.0 + Math.cos(angle)*pointerOut;

        var pix = width/2.0 + Math.sin(angle)*pointerIn;
        var piy = height/2.0 + Math.cos(angle)*pointerIn;

        // draw the hand
        dc.setPenWidth(4);
        dc.drawLine(pix, piy, pox, poy);
    }

    function debug_clip_circle(dc) {
        var width = dc.getWidth();
        var height = dc.getHeight();

        var min;
        if (width > height) {
            min = height;
        } else {
            min = width;
        }

        var iX, iY, oX, oY;
        var furtherOuterRad = min * 0.46;
        var outerRad = min * 0.48;
        var innerRad = min * 0.52;

        // minute marks
        dc.setPenWidth(width_minute_mark);
        var resolution = 275;
        var stats = System.getSystemStats();
        var warning_level = 33.0;
        if (stats.battery < warning_level) {

            var battery = (stats.battery/warning_level);
            var time = System.getClockTime();

            var start = (time.min - 1) * resolution/60;
            var end = (time.min + 2) * resolution/60;
            for (var x = start; x <= end; x += 1) {
                var angle = x * (2.0 * Math.PI / resolution);

                var x0 = width/2.0 + (Math.sin(angle)*outerRad * (1.0 -
                    battery));
                var y0 = height/2.0 - (Math.cos(angle)*outerRad * (1.0 -
                    battery));

                var x1 = width/2.0;
                var y1 = height/2.0;
                if (time.min <= 30) {
                    x1 -= 10;
                } else {
                    x1 += 10;
                }
                if ((time.min > 45) || (time.min <= 15)) {
                    y1 += 10;
                } else {
                    y1 -= 10;
                }

                if (x0 > x1) {
                    var tmp = x0;
                    x0 = x1;
                    x1 = tmp;
                }
                if (y0 > y1) {
                    var tmp = y0;
                    y0 = y1;
                    y1 = tmp;
                }
                dc.setClip(x0, y0, x1-x0, y1-y0);
                dc.fillRectangle(0, 0, width, height);
                dc.clearClip();
            }

            start = ((time.hour + time.min/60.0 - 0.3) * resolution/12)
                .toNumber();
            end = ((time.hour + time.min/60.0 + 0.3) * resolution/12)
                .toNumber()+1;
            for (var x = start; x <= end; x += 1) {
                var angle = x * (2.0 * Math.PI / resolution);

                var x0 = width/2.0 + (Math.sin(angle)*outerRad * (1.0 -
                    battery));
                var y0 = height/2.0 - (Math.cos(angle)*outerRad * (1.0 -
                    battery));

                var x1 = width/2.0;
                var y1 = height/2.0;
                if (time.hour % 12 < 6) {
                    x1 -= 10;
                } else {
                    x1 += 10;
                }
                if ((time.hour % 12 >= 9) || (time.hour % 12 < 3)) {
                    y1 += 10;
                } else {
                    y1 -= 10;
                }


                if (x0 > x1) {
                    var tmp = x0;
                    x0 = x1;
                    x1 = tmp;
                }
                if (y0 > y1) {
                    var tmp = y0;
                    y0 = y1;
                    y1 = tmp;
                }
                dc.setClip(x0, y0, x1-x0, y1-y0);
                dc.fillRectangle(0, 0, width, height);
                dc.clearClip();
            }
        }
    }

    function draw_clip_circle(dc) {
        var width = dc.getWidth();
        var height = dc.getHeight();

        var min;
        if (width > height) {
            min = height;
        } else {
            min = width;
        }

        var iX, iY, oX, oY;
        var furtherOuterRad = min * 0.46;
        var outerRad = min * 0.48;
        var innerRad = min * 0.52;

        // minute marks
        dc.setPenWidth(width_minute_mark);
        var resolution = 275;
        var stats = System.getSystemStats();
        var warning_level = 33.0;
        if (stats.battery >= warning_level) {
            dc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_TRANSPARENT);
            dc.fillCircle(width/2.0, height/2.0, 7.5);
        } else {
            dc.setColor(Graphics.COLOR_RED, Graphics.COLOR_TRANSPARENT);
            dc.fillCircle(width/2.0, height/2.0, 7.5);

            var battery = (stats.battery/warning_level);
            var time = System.getClockTime();

            var start = (time.min - 1) * resolution/60;
            var end = (time.min + 2) * resolution/60;
            for (var x = start; x <= end; x += 1) {
                var angle = x * (2.0 * Math.PI / resolution);

                var x0 = width/2.0 + (Math.sin(angle)*outerRad * (1.0 -
                    battery));
                var y0 = height/2.0 - (Math.cos(angle)*outerRad * (1.0 -
                    battery));

                var x1 = width/2.0;
                var y1 = height/2.0;
                if (time.min <= 30) {
                    x1 -= 10;
                } else {
                    x1 += 10;
                }
                if ((time.min > 45) || (time.min <= 15)) {
                    y1 += 10;
                } else {
                    y1 -= 10;
                }

                if (x0 > x1) {
                    var tmp = x0;
                    x0 = x1;
                    x1 = tmp;
                }
                if (y0 > y1) {
                    var tmp = y0;
                    y0 = y1;
                    y1 = tmp;
                }
                dc.setClip(x0, y0, x1-x0, y1-y0);
                // dc.setColor(Graphics.COLOR_BLUE, Graphics.COLOR_TRANSPARENT);
                // dc.fillRectangle(0, 0, width, height);
                // dc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_TRANSPARENT);
                draw_minute_hand(dc);
                dc.clearClip();
            }

            start = ((time.hour + time.min/60.0 - 0.3) * resolution/12)
                .toNumber();
            end = ((time.hour + time.min/60.0 + 0.3) * resolution/12)
                .toNumber()+1;
            for (var x = start; x <= end; x += 1) {
                var angle = x * (2.0 * Math.PI / resolution);

                var x0 = width/2.0 + (Math.sin(angle)*outerRad * (1.0 -
                    battery));
                var y0 = height/2.0 - (Math.cos(angle)*outerRad * (1.0 -
                    battery));

                var x1 = width/2.0;
                var y1 = height/2.0;
                if (time.hour % 12 < 6) {
                    x1 -= 10;
                } else {
                    x1 += 10;
                }
                if ((time.hour % 12 >= 9) || (time.hour % 12 < 3)) {
                    y1 += 10;
                } else {
                    y1 -= 10;
                }


                if (x0 > x1) {
                    var tmp = x0;
                    x0 = x1;
                    x1 = tmp;
                }
                if (y0 > y1) {
                    var tmp = y0;
                    y0 = y1;
                    y1 = tmp;
                }
                dc.setClip(x0, y0, x1-x0, y1-y0);
                // dc.setColor(Graphics.COLOR_BLUE, Graphics.COLOR_TRANSPARENT);
                // dc.fillRectangle(0, 0, width, height);
                // dc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_TRANSPARENT);
                draw_hour_hand(dc);
                dc.clearClip();
            }
        }
    }

    function draw_analog(dc) {
        var stats = System.getSystemStats();

        if (stats.battery < 25.0) {
            // dc.fillRectangle(battery_meter_x, battery_meter_y,
            //     battery_meter_width*stats.battery/100.0, battery_meter_height);
        }
        // dc.setColor(Graphics.COLOR_BLUE, Graphics.COLOR_TRANSPARENT);
        // debug_clip_circle(dc);
        dc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_TRANSPARENT);
        draw_hour_hand(dc);
        draw_minute_hand(dc);
        draw_clip_circle(dc);
    }

    function draw_hour_hand(dc) {
        var width = dc.getWidth();
        var height = dc.getHeight();

        var min;
        if (width > height) {
            min = height;
        } else {
            min = width;
        }

        var clockTime = System.getClockTime();

        var hourRad = min * 0.13;
        var pointerOut = min * 0.24;
        var pointerIn = min * 0.00;

        // get the angle for the hour
        var angle = ((clockTime.hour % 12) / 12.0) * (-2.0 * Math.PI);
        angle += Math.PI;

        // add the minutes
        angle -= (clockTime.min / 60.0) * (Math.PI / 6);

        // points for the nub
        var pox = width/2.0 + Math.sin(angle)*pointerOut;
        var poy = height/2.0 + Math.cos(angle)*pointerOut;

        var pix = width/2.0 + Math.sin(angle)*pointerIn;
        var piy = height/2.0 + Math.cos(angle)*pointerIn;

        dc.setPenWidth(5);
        dc.drawLine(pix, piy, pox, poy);
    }

    function draw_second_hand(dc) {
        var width = dc.getWidth();
        var height = dc.getHeight();
        var iX, iY, oX, oY;

        var min;
        if (width > height) {
            min = height;
        } else {
            min = width;
        }

        var clockTime = System.getClockTime();

        var furtherOuterRad = min * 0.46;
        var outerRad = min * 0.48;
        var innerRad = min * 0.52;

        // get the angle for seconds
        var angle = (clockTime.sec / 60.0) * (-2.0 * Math.PI);

        for (var x = clockTime.sec - 1; x <= clockTime.sec; x += 1) {
            var angle = x * (Math.PI / 30.0);
            dc.setPenWidth(4);
            oX = width/2.0 + Math.sin(angle)*furtherOuterRad;
            oY = height/2.0 - Math.cos(angle)*furtherOuterRad;
            iX = width/2.0 + Math.sin(angle)*innerRad;
            iY = height/2.0 - Math.cos(angle)*innerRad;
            dc.setClip(oX-10, oY-10, 20, 20);

            if ( x == clockTime.sec) {
                dc.setColor(Graphics.COLOR_RED, Graphics.COLOR_TRANSPARENT);
            } else {
                dc.setColor(Graphics.COLOR_BLACK, Graphics.COLOR_TRANSPARENT);
                dc.drawLine(iX, iY, oX, oY);
                dc.setColor(Graphics.COLOR_LT_GRAY, Graphics.COLOR_TRANSPARENT);
                dc.setPenWidth(width_minute_mark);

                // make the 5 minute marks longer
                if (x % 5 == 0) {
                    oX = width/2.0 + Math.sin(angle)*furtherOuterRad;
                    oY = height/2.0 - Math.cos(angle)*furtherOuterRad;
                } else {
                    oX = width/2.0 + Math.sin(angle)*outerRad;
                    oY = height/2.0 - Math.cos(angle)*outerRad;
                }
            }

            dc.drawLine(iX, iY, oX, oY);
        }
    }

    function onUpdate(dc) {
        dc.clearClip();

        var width = dc.getWidth();
        var height = dc.getHeight();

        var min;
        if (width > height) {
            min = height;
        } else {
            min = width;
        }

        draw_root_window(dc);
        draw_digital_time(dc);
        draw_dayday(dc);
        draw_timezones(dc);
        draw_analog(dc);

        draw_second_hand(dc);
        draw_clip_circle(dc);
    }

    function onPartialUpdate(dc) {
        dc.setColor(Graphics.COLOR_RED, Graphics.COLOR_TRANSPARENT);
        draw_second_hand(dc);
    }

    function onHide() { }

    function onEnterSleep() {
        WatchUi.requestUpdate();
    }

    function onExitSleep() { }
}