diff --git a/ChangeLog b/ChangeLog index f0bbd266..3927a8e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22835,3 +22835,6 @@ * Add missing files to EXTRA_DIST in versions. 2021-12-22 Fred Gleason * Added the ability to filter the library by two scheduler codes. +2021-12-22 Fred Gleason + * Added '%z', '%:z' and '%::z' patterns to the set of filepath + wildcards. diff --git a/docs/opsguide/filepath_wildcards.xml b/docs/opsguide/filepath_wildcards.xml index 3be63e70..3c056762 100644 --- a/docs/opsguide/filepath_wildcards.xml +++ b/docs/opsguide/filepath_wildcards.xml @@ -1,8 +1,8 @@ Filepath Wildcards - Filepath wildcards can be used in most places in RDAdmin where a filename - is required. + Filepath wildcards can be used in most places in RDAdmin and RDCatch + where a filename or URL is required. Definition @@ -473,7 +473,23 @@ z - [unassigned] + -HHMM numeric timezone (e.g. -0400) + + + + + :z + + + -HH:MM numeric timezone (e.g. -04:00) + + + + + ::z + + + -HH:MM:SS numeric timezone (e.g. -04:00:00) @@ -501,7 +517,8 @@ Examples - For the date time of February 3rd, 2017 at 2:34:26 PM: + For the date time of February 3rd, 2017 at 2:34:26 PM, in the + America/New_York timezone: @@ -640,6 +657,22 @@ + + %Y-%m-%dT%H:%M:%S + + + 2017-02-03T14:34:26 + + + + + %Y-%m-%dT%H:%M:%S%:z + + + 2017-02-03T14:34:26-05:00 + + + diff --git a/lib/rdconf.h b/lib/rdconf.h index 4a5eb0a1..d8e3aaf4 100644 --- a/lib/rdconf.h +++ b/lib/rdconf.h @@ -101,7 +101,6 @@ QDateTime RDLocalToUtc(const QDateTime &localdatetime); QTime RDLocalToUtc(const QTime &localtime); QDateTime RDUtcToLocal(const QDateTime &gmtdatetime); QTime RDUtcToLocal(const QTime &gmttime); -//int RDTimeZoneOffset(); QColor RDGetTextColor(const QColor &background_color); bool RDProcessActive(const QString &cmd); bool RDProcessActive(const QStringList &cmds); diff --git a/lib/rddatedecode.cpp b/lib/rddatedecode.cpp index d22acd06..70d7fb31 100644 --- a/lib/rddatedecode.cpp +++ b/lib/rddatedecode.cpp @@ -20,7 +20,44 @@ #include -#include +#include "rdconf.h" +#include "rddatedecode.h" +#include "rddatetime.h" + +QString __RDDateCode_TZFormat(int level) +{ + int offset=RDTimeZoneOffset(); + int hours=abs(offset/3600); + int minutes=(abs(offset)-3600*hours)/60; + int seconds=abs(offset)-3600*hours-60*minutes; + QString ret; + + switch(level) { + case 0: + ret=QString::asprintf("%02d",hours).left(2)+ + QString::asprintf("%02d",minutes).left(2); + break; + + case 1: + ret=QString::asprintf("%02d",hours).left(2)+":"+ + QString::asprintf("%02d",minutes).left(2); + break; + + case 2: + ret=QString::asprintf("%02d",hours).left(2)+":"+ + QString::asprintf("%02d",minutes).left(2)+":"+ + QString::asprintf("%02d",seconds).left(2); + break; + } + if(offset<0) { + ret="+"+ret; + } + else { + ret="-"+ret; + } + + return ret; +} QString RDDateDecode(QString str,const QDate &date,RDStation *station, RDConfig *config,const QString &svcname) @@ -453,6 +490,24 @@ QString RDDateTimeDecode(QString str,const QDateTime &datetime, field=QString::asprintf("%04d",dt.date().year()); break; + case 'z': // +hhmm numeric time zone (e.g., -0400) + field=__RDDateCode_TZFormat(0); + break; + + case ':': // Extended numeric timezones + if((str.length()>(i+1))&&(str.at(i+1)==QChar('z'))) { + field=__RDDateCode_TZFormat(1); + i++; + } + else { + if((str.length()>(i+2))&&(str.at(i+1)==QChar(':'))&& + (str.at(i+2)==QChar('z'))) { + field=__RDDateCode_TZFormat(2); + i+=2; + } + } + break; + case '%': // Literal '%' field=QString("%"); break;