diff options
| author | St33v <github@f3rr3t.com> | 2022-01-04 13:06:07 +1100 |
|---|---|---|
| committer | St33v <github@f3rr3t.com> | 2022-01-04 13:06:07 +1100 |
| commit | b18cd4eceb3786de741d64ec38c79f6ecc6aae49 (patch) | |
| tree | d39090480ff702765ae26ac9c4b2218d1a8bc936 /func/deriveTimeString.sh | |
| parent | 49c3594cf5da2df02d39231f3f69be780ac2120d (diff) | |
func might work - first try
Diffstat (limited to 'func/deriveTimeString.sh')
| -rwxr-xr-x | func/deriveTimeString.sh | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/func/deriveTimeString.sh b/func/deriveTimeString.sh new file mode 100755 index 0000000..5cb8386 --- /dev/null +++ b/func/deriveTimeString.sh @@ -0,0 +1,33 @@ + +# BOM releases four synoptic charts per day. +# They are named according to the UTC dat/time for which they are valid. +# +# Filenames follow this template: IDY00030.YYYYMMDDHHMM.[png|pdf] +# +# IDY00030 = the asset name (i.e. the Mean Sea Level Pressure synoptic chart) +# . +# <datetime string> +# . +# <extension> (I want pdf because it contains a Scalable Vectort Graphic (SVG) image) + + +# This function returns the filename for the most recent chart. + +DeriveTime() { + nowDate=$(\date -u +%y%m%d) # backslash req. to unalias date to raw format + nowTime=$(\date -u +%H%M) # (I have date aliased to date -R) + echo $nowDate$nowTime + + if [ $nowTime -gt 1800 ] ; then + fileTime=1800 + elif [ $nowTime -gt 1200 ] ; then + fileTime=1200 + elif [ $nowTime -gt 0600 ] ; then + fileTime=0600 + else + fileTime=0000 + fi + + echo $nowDate$fileTime +} + |
