MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / setTime

Method setTime

contributed/modClock/main.js:802–819  ·  view source on GitHub ↗
(v, forceRTC=0)

Source from the content-addressed store, hash-verified

800 }
801
802 setTime(v, forceRTC=0) {
803 let tz = this.prefs.tz - 11;
804 Time.timezone = tz * 3600;
805
806 Time.set(v + Time.timezone);
807 let dst = (this.prefs.dst == 2) ? this.checkDSTObserved() : this.prefs.dst;
808 Time.dst = dst * 3600;
809
810 Time.set(v);
811
812 if (this.rtc.exists && (forceRTC || !this.rtc.valid)) {
813 if (!this.rtc.enabled) {
814 this.rtc.enabled = 1;
815 }
816 this.rtc.seconds = v;
817 this.rtc.valid = 1;
818 }
819 }
820
821 fetchTime() {
822 if (this.rtc.valid)

Callers 3

setupRtcMethod · 0.95
setTimeFromTextMethod · 0.95
fetchTimeMethod · 0.95

Calls 2

checkDSTObservedMethod · 0.95
setMethod · 0.65

Tested by

no test coverage detected