From 750bcb896be7ab84cc30de58aba4c4620dfcf54b Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sat, 22 Mar 2014 17:17:30 +0100 Subject: Add local-time-offset and intl. table options --- src/ParserConfigfile.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/ParserConfigfile.cpp') diff --git a/src/ParserConfigfile.cpp b/src/ParserConfigfile.cpp index 74d9588..4a67186 100644 --- a/src/ParserConfigfile.cpp +++ b/src/ParserConfigfile.cpp @@ -189,6 +189,25 @@ void parse_configfile(string configuration_file, /* Extended Country Code */ ensemble->ecc = hexparse(pt_ensemble.get("ecc", "0")); + 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)); + + if (lto_hours < 0.0) { // ensemble->lto is 1-bit complement + ensemble->lto |= (1<<5); // sign bit + } + int success = -5; string ensemble_label = pt_ensemble.get("label"); string ensemble_short_label(ensemble_label); -- cgit v1.2.3