Webtags/Parameters: Difference between revisions

From Cumulus Wiki
Jump to navigationJump to search
24 bytes added ,  05:48, 3 October 2022
m
Line 230: Line 230:
For permanently changing the locale used by your system, the instructions vary considerably according to the kernel used in your operating system, so you need to look up the instructions for yourself. However, if you have a graphical user interface, such as the full Raspberry Pi Operating System provides, you might have a configuration command in terminal mode and a configuration app accessed (within ''Preferences'') from the "Raspberry" key on the official keyboard.  For the Raspberry Pi, please read [[Raspberry Pi computer page]] for more details.
For permanently changing the locale used by your system, the instructions vary considerably according to the kernel used in your operating system, so you need to look up the instructions for yourself. However, if you have a graphical user interface, such as the full Raspberry Pi Operating System provides, you might have a configuration command in terminal mode and a configuration app accessed (within ''Preferences'') from the "Raspberry" key on the official keyboard.  For the Raspberry Pi, please read [[Raspberry Pi computer page]] for more details.


===Time zones===
====Time zones====


Before I explain what time/date output modifiers can do, something they can't do.
Before I explain what time/date output modifiers can do, something they can't do.
Line 240: Line 240:
[[File:Badge vMx.png]]In most MX releases, you can use a script to convert a time to UTC. This is not the place to tell you how to write the script, but taking time of highest pressure today as an example, you would use <#TpressTH format=Hh:mm> and <#TpressTH format=zzz>, the first gives hours and minutes in your local time, and the second gives the offset that needs to be applied to that time to convert it to UTC.
[[File:Badge vMx.png]]In most MX releases, you can use a script to convert a time to UTC. This is not the place to tell you how to write the script, but taking time of highest pressure today as an example, you would use <#TpressTH format=Hh:mm> and <#TpressTH format=zzz>, the first gives hours and minutes in your local time, and the second gives the offset that needs to be applied to that time to convert it to UTC.


===Time resolution===
====Time resolution====


For the legacy software, there may be no point in asking for seconds, as Cumulus 1 did some actions at one minute intervals.  For MX, it depends on which tag name you are using whether it supports seconds (e.g. <#LastDataReadT> supports seconds, but <#LastRainTip> is reported rounded back to previous minute and <#TrrateTM> is reported rounded forward to the next minute).  
For the legacy software, there may be no point in asking for seconds, as Cumulus 1 did some actions at one minute intervals.  For MX, it depends on which tag name you are using whether it supports seconds (e.g. <#LastDataReadT> supports seconds, but <#LastRainTip> is reported rounded back to previous minute and <#TrrateTM> is reported rounded forward to the next minute).  
Line 246: Line 246:
If Cumulus obtained archive data, as part of the catch-up process it can do when it restarts, any time-stamps for that historic period can only be the time of a particular archive record, so that might be every half an hour, but not aligned precisely with hour changes.
If Cumulus obtained archive data, as part of the catch-up process it can do when it restarts, any time-stamps for that historic period can only be the time of a particular archive record, so that might be every half an hour, but not aligned precisely with hour changes.


===Dependency on Cumulus flavour===
====Dependency on Cumulus flavour====


You have to change all date/time formatting when moving from the original (legacy) Cumulus to MX.
You have to change all date/time formatting when moving from the original (legacy) Cumulus to MX.
Line 252: Line 252:
All the tables explaining what is used in each flavour for each type of output, both by including separate columns for each flavour, and by giving examples in each flavour.
All the tables explaining what is used in each flavour for each type of output, both by including separate columns for each flavour, and by giving examples in each flavour.


====For the legacy software====
=====For the legacy software=====


I deal with this first, just because it is simple!
I deal with this first, just because it is simple!
Line 264: Line 264:
**Again, there is an exception, "m" or "M" has two different meanings (minutes or month) depending on context.
**Again, there is an exception, "m" or "M" has two different meanings (minutes or month) depending on context.


====The complications with MX====
=====The complications with MX=====


The [[:Category:Ini Files|*.ini Files]] in MX have adopted the ISO 8601 date format where year comes first (yyyy-MM-dd), although for compatibility with the legacy software, any lines in these files ported from Cumulus 1 retain their day before month before year format until they are updated.  Most dates reported by web tags derive their content from entries in these files.
The [[:Category:Ini Files|*.ini Files]] in MX have adopted the ISO 8601 date format where year comes first (yyyy-MM-dd), although for compatibility with the legacy software, any lines in these files ported from Cumulus 1 retain their day before month before year format until they are updated.  Most dates reported by web tags derive their content from entries in these files.
Line 287: Line 287:




===Time formats===
====Time formats====


Here context matters, so both standard (single character) and custom (two or more characters) formats are shown in the following table.  As explained earlier, time formats can be used with both time-duration reporting and clock time reporting.
Here context matters, so both standard (single character) and custom (two or more characters) formats are shown in the following table.  As explained earlier, time formats can be used with both time-duration reporting and clock time reporting.
Line 463: Line 463:




===Year formats===
====Year formats====


These are the simplest output format modifiers.  We can only choose from 2 options, and because both involve more than one character their context does not matter.  Although the legacy Cumulus will accept upper case as meaning same as lower case, it is simplest if we just show the lower case options that are mandatory for MX:
These are the simplest output format modifiers.  We can only choose from 2 options, and because both involve more than one character their context does not matter.  Although the legacy Cumulus will accept upper case as meaning same as lower case, it is simplest if we just show the lower case options that are mandatory for MX:
Line 482: Line 482:
|}
|}


===Month formats===
====Month formats====


All locales offer both numerical and alphabetical formats for representing months.
All locales offer both numerical and alphabetical formats for representing months.
Line 526: Line 526:
|}
|}


===Day formats===
====Day formats====


All locales offer both numerical and alphabetical formats for representing a day.
All locales offer both numerical and alphabetical formats for representing a day.
Line 565: Line 565:
|}
|}


===Date formats===
====Date formats====


The [[#Year formats]], [[#Month formats]], and [[#Day formats]] listed above can be combined to make up a date output modifier, but there are some other modifiers available that can produce whole dates.
The [[#Year formats]], [[#Month formats]], and [[#Day formats]] listed above can be combined to make up a date output modifier, but there are some other modifiers available that can produce whole dates.
Line 630: Line 630:
|}
|}


=== Literals in scripts===
==== Literals in scripts====


If you are considering use of literals (such as a space) within a output format modifier in a script, then don't. Instead include whatever precedes the literal in a tag specification, then concatenate on the literal, and finally concatenate another tag specification for whatever is to follow the literal.  An example to make this clearer is <code>$MXDateTime = '<#date format=yyyy-MM-dd>' . 'T' . '<#time format=hh:mm:ss>';</code>, which is written in PHP Hypertext Pre-processor format, the literal 'T' has been inserted by using two separate web tags surrounding the literal.  The same approach applies if you wanted to replace that "T" with a space.  (The explanation is that Cumulus (1 and MX) requires single quotes round a literal, but the script language requires any string to be enclosed in quotes, and double quotes are required by Cumulus round any complex specifier including any that include a space or other literal).
If you are considering use of literals (such as a space) within a output format modifier in a script, then don't. Instead include whatever precedes the literal in a tag specification, then concatenate on the literal, and finally concatenate another tag specification for whatever is to follow the literal.  An example to make this clearer is <code>$MXDateTime = '<#date format=yyyy-MM-dd>' . 'T' . '<#time format=hh:mm:ss>';</code>, which is written in PHP Hypertext Pre-processor format, the literal 'T' has been inserted by using two separate web tags surrounding the literal.  The same approach applies if you wanted to replace that "T" with a space.  (The explanation is that Cumulus (1 and MX) requires single quotes round a literal, but the script language requires any string to be enclosed in quotes, and double quotes are required by Cumulus round any complex specifier including any that include a space or other literal).


===Use of spaces===
====Use of spaces====


[[File:Badge vMx.png]]The first complication is that the parser that interprets time/date characters has two ways of interpreting a space character, depending on what immediately follows.  In the tables, below, I have used a "%" in various places. In any of those places with a "%", you can insert a space instead,  understanding that space is not a gap between format characters, but simply an alternative to "%" as a special character.  To explain the two ways of interpreting spaces consider as an example '''<#TpressTH format=" h:mm tt">'''. In that example the two spaces are interpreted in two different ways! The "space" before "h" is treated as the same as "%", but as the ''mm'' and ''tt'' are multi-character symbols, that does insert a space after the minutes but before the am/pm. I discuss this later in [[#Migrating from legacy Cumulus 1 to MX]] section.
[[File:Badge vMx.png]]The first complication is that the parser that interprets time/date characters has two ways of interpreting a space character, depending on what immediately follows.  In the tables, below, I have used a "%" in various places. In any of those places with a "%", you can insert a space instead,  understanding that space is not a gap between format characters, but simply an alternative to "%" as a special character.  To explain the two ways of interpreting spaces consider as an example '''<#TpressTH format=" h:mm tt">'''. In that example the two spaces are interpreted in two different ways! The "space" before "h" is treated as the same as "%", but as the ''mm'' and ''tt'' are multi-character symbols, that does insert a space after the minutes but before the am/pm. I discuss this later in [[#Migrating from legacy Cumulus 1 to MX]] section.

Navigation menu