To implement a use case of a Java application running in Kubernetes, I needed to be able to dynamically set the time offset from outside the Java process.
Every time System.currentTimeMillis() is called, the offset is now read from the file specified in the Java property faketime.offset.file instead of directly from the property faketime.offset.seconds. If the property is not set, the offset in faketime.offset.seconds is used as before.
This enables one to dynamically set the offset in a Kubernetes ConfigMap object, which is mounted in the Java application container as a file.
To implement a use case of a Java application running in Kubernetes, I needed to be able to dynamically set the time offset from outside the Java process. Every time
System.currentTimeMillis()
is called, the offset is now read from the file specified in the Java propertyfaketime.offset.file
instead of directly from the propertyfaketime.offset.seconds
. If the property is not set, the offset infaketime.offset.seconds
is used as before.This enables one to dynamically set the offset in a Kubernetes ConfigMap object, which is mounted in the Java application container as a file.