I am writing a Java program to access the OSPI using the supplied API. Using JSON to query device time (devt) returns a long value of 1489421723. This translates to 13/03/2017 12:15 PM but this date/time value is four hours less than the actual local computer time. That is, the query was made at 13/03/2017 04:15 PM.
devt: Device time (epoch time). This is always the local time.
My Java code to calculate the date/time:
Long devt = 1489421723:
Date date = new Date();
date.setTime((long) devt * 1000);
DateFormat df = new SimpleDateFormat("dd/MM/yyyy hh:mm a");
String str = df.format(date);
System.out.println(str + " devt = " + devt);
The devt returned by the controller is always GMT+0. That combined with the time zone settings gives you the correct local time. The reason it’s done this way is so that the controller just needs to store GMT+0 time, and it remains the same whichever time zone you are in.