summaryrefslogtreecommitdiffstats
path: root/src/ParserConfigfile.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2014-04-19 00:27:29 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2014-04-19 00:27:29 +0200
commit2ef42b865cd88f274958bde780c2731e0434eb34 (patch)
tree49e5257b90efd777d4b122821c03fa2277f1e6bf /src/ParserConfigfile.cpp
parent9829cd690856e987704996efb52be3c8e1b840cf (diff)
downloaddabmux-2ef42b865cd88f274958bde780c2731e0434eb34.tar.gz
dabmux-2ef42b865cd88f274958bde780c2731e0434eb34.tar.bz2
dabmux-2ef42b865cd88f274958bde780c2731e0434eb34.zip
Add support for automatic local-time-offset
Diffstat (limited to 'src/ParserConfigfile.cpp')
-rw-r--r--src/ParserConfigfile.cpp32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/ParserConfigfile.cpp b/src/ParserConfigfile.cpp
index b477f1d..f515a5c 100644
--- a/src/ParserConfigfile.cpp
+++ b/src/ParserConfigfile.cpp
@@ -191,18 +191,26 @@ void parse_configfile(string configuration_file,
ensemble->international_table = pt_ensemble.get("international-table", 0);
- double lto_hours = pt_ensemble.get("local-time-offset", 0.0);
- if (round(lto_hours * 2) != lto_hours * 2) {
- etiLog.level(error) << "Ensemble local time offset " <<
- lto_hours << "h cannot be expressed in half-hour blocks.";
- throw runtime_error("ensemble local-time-offset definition error");
- }
- if (lto_hours > 12 || lto_hours < -12) {
- etiLog.level(error) << "Ensemble local time offset " <<
- lto_hours << "h out of bounds [-12, +12].";
- throw runtime_error("ensemble local-time-offset definition error");
- }
- ensemble->lto = abs(rint(lto_hours * 2));
+ string lto_auto = pt_ensemble.get("local-time-offset", "");
+ if (lto_auto == "auto") {
+ ensemble->lto_auto = true;
+ ensemble->lto = 0;
+ }
+ else {
+ double lto_hours = pt_ensemble.get("local-time-offset", 0.0);
+ if (round(lto_hours * 2) != lto_hours * 2) {
+ etiLog.level(error) << "Ensemble local time offset " <<
+ lto_hours << "h cannot be expressed in half-hour blocks.";
+ throw runtime_error("ensemble local-time-offset definition error");
+ }
+ if (lto_hours > 12 || lto_hours < -12) {
+ etiLog.level(error) << "Ensemble local time offset " <<
+ lto_hours << "h out of bounds [-12, +12].";
+ throw runtime_error("ensemble local-time-offset definition error");
+ }
+ ensemble->lto_auto = false;
+ ensemble->lto = abs(rint(lto_hours * 2));
+ }
int success = -5;
string ensemble_label = pt_ensemble.get<string>("label");