Difference between revisions of "SHIP:System Variable:shiptime"

From Serious Documentation
Jump to: navigation, search
(Created page with "{{SysVarTableStart|}} |<onlyinclude>{{SysVar|shiptime}}||{{DataType|Time}}||Read/Write||This variable tracks the current system time. You can change these values, but they ar...")
 
Line 5: Line 5:
 
It is very easy to create a clock in our GUI by listening to {{SysVar|shiptime}}.  The simple script<br/>
 
It is very easy to create a clock in our GUI by listening to {{SysVar|shiptime}}.  The simple script<br/>
 
<code>
 
<code>
: text.value = [[SHIP:Sail:toString|toString(shiptime.day)]];
+
: text.value = [[SHIP:Sail:toString|toString(shiptime.hour,2)]] + ":" + [[SHIP:Sail:toString|toString(shiptime.minute,2)]] ;
 
</code>
 
</code>
  
 
within a {{Node|listener}} with the {{Prop|listener|listeningto}} property set to "shiptime.minute" will automatically keep the text value updated every second.
 
within a {{Node|listener}} with the {{Prop|listener|listeningto}} property set to "shiptime.minute" will automatically keep the text value updated every second.

Revision as of 08:39, 1 April 2014

System Variable Data Type Permissions Description
shiptime Time Read/Write This variable tracks the current system time. You can change these values, but they are only retained across power cycles if the platform has battery-backed RTCC capabilities.

It is very easy to create a clock in our GUI by listening to shiptime. The simple script

text.value = toString(shiptime.hour,2) + ":" + toString(shiptime.minute,2) ;

within a listener with the listeningto property set to "shiptime.minute" will automatically keep the text value updated every second.