summaryrefslogtreecommitdiffstats
path: root/src/MuxElements.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/MuxElements.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/MuxElements.cpp')
-rw-r--r--src/MuxElements.cpp33
1 files changed, 22 insertions, 11 deletions
diff --git a/src/MuxElements.cpp b/src/MuxElements.cpp
index 03e9bbf..c7ac076 100644
--- a/src/MuxElements.cpp
+++ b/src/MuxElements.cpp
@@ -389,18 +389,24 @@ void dabEnsemble::set_parameter(const string& parameter, const string& value)
ss.exceptions ( stringstream::failbit | stringstream::badbit );
if (parameter == "localtimeoffset") {
- int new_lto = atol(value.c_str());
-
- if (new_lto < -24) {
- throw ParameterError("Desired local time offset too small."
- " Minimum -24" );
- }
- else if (new_lto > 24) {
- throw ParameterError("Desired local time offset too large."
- " Maximum 24" );
+ if (value == "auto") {
+ lto_auto = true;
}
+ else {
+ lto_auto = false;
+ int new_lto = atol(value.c_str());
+
+ if (new_lto < -24) {
+ throw ParameterError("Desired local time offset too small."
+ " Minimum -24" );
+ }
+ else if (new_lto > 24) {
+ throw ParameterError("Desired local time offset too large."
+ " Maximum 24" );
+ }
- this->lto = new_lto;
+ this->lto = new_lto;
+ }
}
else {
stringstream ss;
@@ -414,7 +420,12 @@ const string dabEnsemble::get_parameter(const string& parameter) const
{
stringstream ss;
if (parameter == "localtimeoffset") {
- ss << this->lto;
+ if (this->lto_auto) {
+ ss << "auto(" << this->lto << ")";
+ }
+ else {
+ ss << this->lto;
+ }
}
else {
ss << "Parameter '" << parameter <<