Webtags (preserving history): Difference between revisions

m
Line 909: Line 909:
[[File:Badge vMx.png]]Available from version 3.5.2
[[File:Badge vMx.png]]Available from version 3.5.2


The JavaScript '''Date''' object contains the number of miliseconds since 00:00:00.000 UTC on 1st January 1970, that date and time is known as the UNIX Epoch.  In JavaScript, you can use <tt>Math.floor(new Date().getTime()/1000.0)</tt> This getTime method returns the time in milliseconds.  The web tag returns an integer (currently with 13 digits) representing the number of milliseconds since the UNIX epoch when the web tag was processed. It can be used in a script where you wish to re-express other times output by Cumulus MX into UTC (Coordinated Universal Time).  Mac OS X uses 00:00:00.000 UTC on 1st January 2001 as the starting time and date for its millisecond count, so that is considerably lower.
Note that UTC is calculated using 9192631770 times a particular transition time for Caesium 133 as a basis for 1 second. GMT (Greenwich Mean Time) is calculated on the basis that 1 second is 1/86400 of the time taken for a whole (day) rotation of the Earth. UT1 (or solar time) is calculated from various space measurements. Periodically, leap seconds are added to UTC to realign it with UT1, but these leap seconds are not added to the count of milliseconds represented by this web tag.
Do be aware that some devices will use a 32 bit signed integer to represent this number, and that will stop working on 19 January 2038, the year 2038 problem for computing world.
|-
|-
|<#timeUnix>
|<#timeUnix>
Line 915: Line 920:
[[File:Badge vMx.png]]Available from version 3.7.0
[[File:Badge vMx.png]]Available from version 3.7.0


Same as previous, it provides the last update time as a Unix timestamp - which is since 1 Jan 1970.
Unix tracks the number of seconds since the UNIX epoch. So this web tag can be used when you do not want the millisecond accuracy of the previous web tag. Like previous web tag this relates to UTC, so see details for that tag to find out more. This is equivalent in PHP 5 and PHP 7 to '''time();''' (in PHP 8, a parameter is mandatory for time function, so the call changes).
 
The unix time stamp is a way to track time as a running total of seconds. This count starts at the Unix Epoch on January 1st, 1970 at UTC. Therefore, the unix time stamp is merely the number of seconds between a particular date and the Unix Epoch. It should also be pointed out (thanks to the comments from visitors to this site) that this point in time technically does not change no matter where you are located on the globe. This is very useful to computer systems for tracking and sorting dated information in dynamic and distributed applications both online and client side.
 
Note that it stops working on 19 Jan 2038, unless the device that MX is running on, and the web server where this tag is viewed, use 64 bit or better technology.
|-
|-
|<#LastDataReadT>
|<#LastDataReadT>
|The date/time data was last read from the station
|The date/time data was last read from the station. Default format for this tag is like this example '''18:30 on 30 December 2009''', but output parameters for both date and time can modify this to include seconds in 1.9.x builds and most MX builds such as per this example  '<#LastDataReadT format="yyyy-MM-dd HH:mm:ss">'.
|-
|-
|<#DaysSince30Dec1899>  
|<#DaysSince30Dec1899>  
Line 928: Line 929:
|-
|-
|<#recordsbegandate>
|<#recordsbegandate>
|Date when records began (appears twice on "recordsT.htm" provided, and used to calculate next tag, but ignored for all other Cumulus processing)
|Date when records began (appears twice on "recordT.htm" provided in standard web page, and used to calculate next tag, but ignored for all other Cumulus processing). Any output parameters valid for a date can be used here, don't forget differences in modifiers for Cumulus 1 and MX. There is no time associated with this web tag.  The default format is like 30 December 2009, please note although this web tag reports the value associated with  [b]StartDate=dd/MM/yyyy[/b] (see [[Cumulus.ini#Section:_Station]]), the format there is short-date format and different to default format for this web tag.
|-
|-
|<#DaysSinceRecordsBegan>
|<#DaysSinceRecordsBegan>
5,838

edits