Add UTC time to watch face
This commit is contained in:
@@ -46,11 +46,23 @@ Graphics.prototype.setFontAnton = function(scale) {
|
|||||||
|
|
||||||
var date = new Date();
|
var date = new Date();
|
||||||
var timeStr = require("locale").time(date, 1); // Hour and minute
|
var timeStr = require("locale").time(date, 1); // Hour and minute
|
||||||
g.setFontAlign(0, 0).setFont("Anton").drawString(timeStr, x, y+20);
|
g.setFontAlign(0, 0).setFont("Vector", 60).drawString(timeStr, x, y); // Used to be Anton, +20
|
||||||
|
|
||||||
|
var utc_sec = getTime();
|
||||||
|
var utc = utc_sec % 86400;
|
||||||
|
var utcHour = Math.floor(utc / 3600);
|
||||||
|
var utcMinute = Math.floor((utc % 3600) / 60);
|
||||||
|
var utcStr = utcHour.toString().padStart(2, '0') + ":" + utcMinute.toString().padStart(2, '0');
|
||||||
|
g.setFontAlign(0, 0).setFont("Vector", 36).drawString(utcStr, x-25, y+43);
|
||||||
|
|
||||||
|
var tz_offset = date.toString().indexOf("GMT");
|
||||||
|
var tz = date.toString().substring(tz_offset+3, tz_offset+6);
|
||||||
|
g.setFontAlign(0, 0).setFont("Vector", 24).drawString(tz, x+60, y+43);
|
||||||
|
|
||||||
// Show date and day of week
|
// Show date and day of week
|
||||||
const days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
const days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
||||||
var dateStr = date.getDate() + " " + days[date.getDay()] + " " + temperature;
|
var dateStr = date.getDate() + " " + days[date.getDay()] + " " + temperature;
|
||||||
g.setFontAlign(0, 0).setFont("Vector", 26).drawString(dateStr, x, y+70);
|
g.setFontAlign(0, 0).setFont("Vector", 26).drawString(dateStr, x, y+76);
|
||||||
|
|
||||||
//var wrapped = g.wrapString(myMessage, g.getWidth()-10).join("\n");
|
//var wrapped = g.wrapString(myMessage, g.getWidth()-10).join("\n");
|
||||||
g.setFontAlign(0, 0).setFont("Vector", 26).drawString(myMessage, x, y-45);
|
g.setFontAlign(0, 0).setFont("Vector", 26).drawString(myMessage, x, y-45);
|
||||||
|
|||||||
Reference in New Issue
Block a user