As requested by some users I have added a new component called "Time".
This component can be used in two different ways, it either converts a provided UTC timestamp to a humanly readable date & time or displays elapsed time in seconds as a value in days, hours, minutes & seconds
Mode - TimestampThe status you would send from your device has to be a UTC timestamp as a 32 bit integer (in seconds). Theoretically the component can also accept values as a 64 bit integer (milliseconds) so it would also work from Node.js or something bigger than a small 32bit micro-controller.
Important: The timestamp has to include any relevant timezone offsets & daytime savings to be correctly converted.
The best option to ensure correct timezone calculations is to use the built-in ChipChop.useClock(true) as the timestamp sent by the ChipChop server to your device happens on a regular intervals and already has all time offsets pre-calculated for you.
Example
void setup(){
....
ChipChop.useClock(true); // activate the real-time clock synchronised by the server specifically for your device
}
void loop(){
...
int current_timestamp = ChipChop.Date.timestamp; // grab the current time stamp provided by the ChipChop engine
//use the timestamp however you want
current_timestamp = current_timestamp + 1800; // adding 32 minutes to the timestamp
ChipChop.updateStatus("time_component", current_timestamp);
}
Mode - Elapsed timeThe elapsed time is extremely easy to use, simply send some value in seconds and it will be displayed in the Dev Console or App as days, hours, minutes & seconds
For example
ChipChop.updateStatus("elapsed_time", 124892); would display as
1d 10h 41m 32sEnjoy
Gizmo