summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9c9cf60)
raw | patch | inline | side by side (parent: 9c9cf60)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Thu, 11 Nov 2010 16:12:17 +0000 (16:12 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Thu, 11 Nov 2010 16:12:17 +0000 (16:12 +0000) |
This disambiguates between some "at-style" time specs:
11111111 yields an error message:
did you really mean month 1111111?
and
19711205 denotes Dec 12, 1971 and not the timestamp.
The patch allows to write:
epoch+11111111s or epoch+19711205s
-- Peter Stamfest
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@2147 a5681a0c-68f1-0310-ab6d-d61299d08faa
11111111 yields an error message:
did you really mean month 1111111?
and
19711205 denotes Dec 12, 1971 and not the timestamp.
The patch allows to write:
epoch+11111111s or epoch+19711205s
-- Peter Stamfest
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@2147 a5681a0c-68f1-0310-ab6d-d61299d08faa
doc/rrdfetch.pod | patch | blob | history | |
src/rrd.h | patch | blob | history | |
src/rrd_parsetime.c | patch | blob | history |
diff --git a/doc/rrdfetch.pod b/doc/rrdfetch.pod
index 49b8fc2f066180430303db826f951e144fe4bf59..29f91bc4d873291ca240a3a3f3f6bd06c2ea5607 100644 (file)
--- a/doc/rrdfetch.pod
+++ b/doc/rrdfetch.pod
I<NOTE2>: if you specify the I<day> in this way, the I<time-of-day> is
REQUIRED as well.
I<NOTE2>: if you specify the I<day> in this way, the I<time-of-day> is
REQUIRED as well.
-Finally, you can use the words B<now>, B<start>, or B<end> as your time
+Finally, you can use the words B<now>, B<start>, B<end> or B<epoch> as your time
reference. B<Now> refers to the current moment (and is also the default
time reference). B<Start> (B<end>) can be used to specify a time
relative to the start (end) time for those tools that use these
reference. B<Now> refers to the current moment (and is also the default
time reference). B<Start> (B<end>) can be used to specify a time
relative to the start (end) time for those tools that use these
-categories (B<rrdfetch>, L<rrdgraph>).
+categories (B<rrdfetch>, L<rrdgraph>) and B<epoch> indicates the
+*IX epoch (*IX timestamp 0 = 1970-01-01 00:00:00 UTC). B<epoch> is
+useful to disambiguate between a timestamp value and some forms
+of abbreviated date/time specifications, because it allows to use
+time offset specifications using units, eg. B<epoch>+19711205s unambiguously
+denotes timestamp 19711205 and not 1971-12-05 00:00:00 UTC.
Month and day of the week names can be used in their naturally
abbreviated form (e.g., Dec for December, Sun for Sunday, etc.). The
Month and day of the week names can be used in their naturally
abbreviated form (e.g., Dec for December, Sun for Sunday, etc.). The
diff --git a/src/rrd.h b/src/rrd.h
index 7e63110e9222bd7d7b1c47e79507f534e0829b53..53838c04a3abb975717264aa637a02e323cceb36 100644 (file)
--- a/src/rrd.h
+++ b/src/rrd.h
typedef enum {
ABSOLUTE_TIME,
RELATIVE_TO_START_TIME,
typedef enum {
ABSOLUTE_TIME,
RELATIVE_TO_START_TIME,
- RELATIVE_TO_END_TIME
+ RELATIVE_TO_END_TIME,
+ RELATIVE_TO_EPOCH
} rrd_timetype_t;
#define TIME_OK NULL
} rrd_timetype_t;
#define TIME_OK NULL
diff --git a/src/rrd_parsetime.c b/src/rrd_parsetime.c
index f3a8e2ec094b8d049303b3a4655c2c4bc35b200a..1b59f454252a851a72f6cf0d2e3a4fe433393f73 100644 (file)
--- a/src/rrd_parsetime.c
+++ b/src/rrd_parsetime.c
enum { /* symbols */
MIDNIGHT, NOON, TEATIME,
enum { /* symbols */
MIDNIGHT, NOON, TEATIME,
- PM, AM, YESTERDAY, TODAY, TOMORROW, NOW, START, END,
+ PM, AM, YESTERDAY, TODAY, TOMORROW, NOW, START, END, EPOCH,
SECONDS, MINUTES, HOURS, DAYS, WEEKS, MONTHS, YEARS,
MONTHS_MINUTES,
NUMBER, PLUS, MINUS, DOT, COLON, SLASH, ID, JUNK,
SECONDS, MINUTES, HOURS, DAYS, WEEKS, MONTHS, YEARS,
MONTHS_MINUTES,
NUMBER, PLUS, MINUS, DOT, COLON, SLASH, ID, JUNK,
{"s", START},
{"end", END},
{"e", END},
{"s", START},
{"end", END},
{"e", END},
+ {"epoch", EPOCH},
{"jan", JAN},
{"feb", FEB},
{"jan", JAN},
{"feb", FEB},
case MINUS:
break; /* jump to OFFSET-SPEC part */
case MINUS:
break; /* jump to OFFSET-SPEC part */
+ case EPOCH:
+ ptv->type = RELATIVE_TO_EPOCH;
+ goto KeepItRelative;
case START:
ptv->type = RELATIVE_TO_START_TIME;
goto KeepItRelative;
case START:
ptv->type = RELATIVE_TO_START_TIME;
goto KeepItRelative;