EHSx: usage of local time | Telit Cinterion IoT Developer Community
June 8, 2015 - 2:40pm, 2382 views
Hello,
I'm using the EHS6 module and in my current project I need to use local time (Europe/Amsterdam) including daylight saving. The first problem is that the current firmware does only support one timezone: GMT.
My approach is to extend the abstract TimeZone class and implement all time zone specific rules. This is working but the drawback of this approach is that I always need to use this new class in combination with the Calendar.getInstance(timezone) method.
Now I was wondering if there is any way to register this timezone to the JVM or some other way to set this new one as the default timezone. The abstract TimeZone class has some static method for getting the default timezone etc, but these cannot be overridden.
Anyone any idea?
Hello,
If you just need to set the local time maybe you should consider getting the time from the network provider.
Please check the at commands:
at^sind="nitz",1
AT+CTZR and AT+CTZU
Not all providers may support this.
Or some NTP implementation to update the time with time server.
Regards,
Bartłomiej
Thank you for your reply. The problem is not the time sync part but the use of local time including scheduling and calculations based on local time. :)
Also the implementation of the timezone by extending the TimeZone class is not even that hard. But the part to let the module use this timezone, by default, is unclear by me. Now I have to pass an instance of this TimeZone implementation object every time I use the Calendar class.
The java SE version of the TimeZone class has a setDefault(TimeZone tz) method to change the overal default timezone implementation. The JVM of the Gemalto module is missing this method.
I was hoping that maybe synchronizing with the network time will be enough for your solution.
This API is limited in comparison to SE so I'm afraid you will have to live with it.
You can only build your API on top of what is available.
Regards,
Bartłomiej