Package com.kosdev.kos.core.service.time
Class TimeService
java.lang.Object
com.kosdev.kos.core.service.time.TimeService
Tracks time changes, time drift and generates time related events.
- Since:
- 1
- Version:
- 1
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionReturn the current timeZone in effect.voidsetDate(int month, int day, int year) Set the date for the entire device.voidsetTime(int hour, int min, int sec) Set the time for the entire device.voidsetTimeZone(String timeZone) Set the timezone for the entire device.
-
Field Details
-
TOPIC_TIME_CHANGE
- See Also:
-
TOPIC_DAY_CHANGE
- See Also:
-
TOPIC_TIMEZONE_CHANGE
- See Also:
-
-
Method Details
-
setTime
public void setTime(int hour, int min, int sec) Set the time for the entire device. This will update the time on all nodes within the device. Use theTimeChangeListenerinterface to react to time changes as time may not be set in the entire device by the time this method returns.- Parameters:
hour- hour: 0..23min- minutes: 0..59sec- seconds: 0..59- Since:
- 1
-
setDate
public void setDate(int month, int day, int year) Set the date for the entire device. This will update the date on all nodes within the device. Use theTimeChangeListenerinterface to react to date changes as date may not be set in the entire device by the time this method returns.NOTE!: Month is zero-based which matches java date conventions.
- Parameters:
month- month of year: 0..11day- day of month: 1..31year- year: full year- Since:
- 1
-
setTimeZone
Set the timezone for the entire device. This will update the timezone on all nodes within the device. Use theTimeZoneChangeListenerinterface to react to timezone changes as timezone may not be set in the entire device by the time this method returns.Setting the timezone will update the timezone in linux as well as all running jvm's. Other processes may not receive updated timezone information as there is not a standard mechanism to notify all processes in linux of a timezone change and timezone is typically cached in the TZ environment variable when linux processes starts.
- Parameters:
timeZone- linux timeZone name- Since:
- 1
-
getTimeZone
Return the current timeZone in effect. This is the timeZone from the linux filesystem and should be reflected in the default jvm timeZone.- Since:
- 1
-