Skip to main content
Android mainboards · Touch displays · Firmware — since 2013

System time

Static methodsBroadcast — returns void

Set the device clock manually, point it at an NTP server, or hand time-keeping to the network. Getting time right matters here because the power schedules run against this clock.

Set the time​

public static void setSystemTime(
Context context,
String hour, // "0" - "23"
String min) // "0" - "59"
ItempApiPub.setSystemTime(context, "14", "30"); // 14:30

Set the date​

public static void setSystemDate(
Context context,
String year, // e.g. "2026"
String month, // "1" - "12"
String day) // "1" - "31"
ItempApiPub.setSystemDate(context, "2026", "8", "10");

NTP server​

public static void setNtpServer(Context context, String ntpServer)
ItempApiPub.setNtpServer(context, "pool.ntp.org");

The NTP server is only consulted when automatic time is enabled (below) and the device has a network path to it.

Automatic time and time zone​

public static void setAutoTimeEnable(Context context, boolean enable)
public static void setAutoTimeZoneEnable(Context context, boolean enable)
ItempApiPub.setAutoTimeEnable(context, true); // sync clock from network
ItempApiPub.setAutoTimeZoneEnable(context, true); // pick time zone from network

Notes​

Manual and automatic fight each other. If auto-time is on, the network will overwrite anything you set with setSystemTime. For a fixed manual clock, disable auto-time first.

No offline sync. With no network path to the NTP server, auto-time keeps the last known time and drifts. On an offline kiosk, set the clock manually and rely on the RTC.

Arguments are strings. "8", not 8. Do not zero-pad month or day.