summaryrefslogtreecommitdiff
path: root/datetime.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2004-08-24 02:11:32 -0400
committerJohn Wiegley <johnw@newartisans.com>2004-08-24 02:11:32 -0400
commit1fd37a432d060a08254ecb1a9129050563075140 (patch)
treef80ee5bf2b780f315348c2767150b9643e9d9488 /datetime.cc
parent73e2abd1b2e2bacbd353999a7b3edd95a04112c4 (diff)
downloadfork-ledger-1fd37a432d060a08254ecb1a9129050563075140.tar.gz
fork-ledger-1fd37a432d060a08254ecb1a9129050563075140.tar.bz2
fork-ledger-1fd37a432d060a08254ecb1a9129050563075140.zip
cleanup; fully switched to autoconf -- use scripts/acprep
Diffstat (limited to 'datetime.cc')
-rw-r--r--datetime.cc31
1 files changed, 21 insertions, 10 deletions
diff --git a/datetime.cc b/datetime.cc
index 8984d2b2..7aa26b13 100644
--- a/datetime.cc
+++ b/datetime.cc
@@ -86,8 +86,11 @@ static void parse_inclusion_specifier(const std::string& word,
if (when.tm_mday == -1)
when.tm_mday = 1;
- *begin = std::mktime(&when);
- *end = interval_t(0, saw_mon ? 1 : 0, saw_year ? 1 : 0).increment(*begin);
+ if (begin)
+ *begin = std::mktime(&when);
+ if (end)
+ *end = interval_t(0, saw_mon ? 1 : 0,
+ saw_year ? 1 : 0).increment(*begin);
}
interval_t interval_t::parse(std::istream& in,
@@ -166,20 +169,28 @@ interval_t interval_t::parse(std::istream& in,
if (type == "last") {
if (mon_spec) {
- *begin = interval_t(0, -1, 0).increment(*begin);
- *end = interval_t(0, -1, 0).increment(*end);
+ if (begin)
+ *begin = interval_t(0, -1, 0).increment(*begin);
+ if (end)
+ *end = interval_t(0, -1, 0).increment(*end);
} else {
- *begin = interval_t(0, 0, -1).increment(*begin);
- *end = interval_t(0, 0, -1).increment(*end);
+ if (begin)
+ *begin = interval_t(0, 0, -1).increment(*begin);
+ if (end)
+ *end = interval_t(0, 0, -1).increment(*end);
}
}
else if (type == "next") {
if (mon_spec) {
- *begin = interval_t(0, 1, 0).increment(*begin);
- *end = interval_t(0, 1, 0).increment(*end);
+ if (begin)
+ *begin = interval_t(0, 1, 0).increment(*begin);
+ if (end)
+ *end = interval_t(0, 1, 0).increment(*end);
} else {
- *begin = interval_t(0, 0, 1).increment(*begin);
- *end = interval_t(0, 0, 1).increment(*end);
+ if (begin)
+ *begin = interval_t(0, 0, 1).increment(*begin);
+ if (end)
+ *end = interval_t(0, 0, 1).increment(*end);
}
}
}