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);
Does anybody know why this discrepancy exists?