This commit is contained in:
Gangphon 2024-02-02 22:03:34 +08:00
parent 6f0d507e50
commit 1deb6b3c4b
3 changed files with 4 additions and 5 deletions

View File

@ -33,8 +33,7 @@ public class SrcAnaClock extends View implements Choreographer.FrameCallback {
super(prog.getContext());
var timeZoneStr = source.str("timeZone");
//if(timeZoneStr!=null) timeZone = ZoneId.of(timeZoneStr);
TimeZone timeZone = null;
if(timeZoneStr!=null) timeZone = TimeZone.getTimeZone(timeZoneStr);
var timeZone = timeZoneStr==null ? null : TimeZone.getTimeZone(timeZoneStr);
calendar = timeZone==null ? Calendar.getInstance() : Calendar.getInstance(timeZone);
var sideLen = Math.min(w, h);
@ -127,7 +126,7 @@ public class SrcAnaClock extends View implements Choreographer.FrameCallback {
void cal() {
//var time = timeZone==null ? LocalTime.now() : LocalTime.now(timeZone);
calendar.setTimeInMillis(lastSec);
calendar.setTimeInMillis(lastSec*1000);
sAngle = calendar.get(Calendar.SECOND) * 6;
mAngle = calendar.get(Calendar.MINUTE) * 6 + sAngle/60;
hAngle = calendar.get(Calendar.HOUR_OF_DAY) * 30 + mAngle/12;

View File

@ -238,7 +238,7 @@ public class SrcDigiClock extends LinearBox implements Choreographer.FrameCallba
void cal() {
//var dt = timeZone==null ? LocalDateTime.now() : LocalDateTime.now(timeZone);
calendar.setTimeInMillis(lastSec);
calendar.setTimeInMillis(lastSec*1000);
var hms = timeptn.format(calendar.getTime());
ampmComp.setImageBitmap(imgs.get(calendar.get(Calendar.HOUR_OF_DAY) < 12?"AM":"PM"));
hourComps[0].setImageBitmap(imgs.get(hms.substring(0,1)));

View File

@ -58,7 +58,7 @@ public class SrcDigitalClock extends WebView implements Choreographer.FrameCallb
}
void cal() {
calendar.setTimeInMillis(lastSec);
calendar.setTimeInMillis(lastSec*1000);
var htm = html;
if(hasYear) htm = htm.replace("%y", Long.toString(calendar.get(Calendar.YEAR)));
try {