move BTS-specific timezone override into sub-structure
Group all three structure members involved in bts-specific timezone
handling into a sub-structure.
diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h
index 7db41c3..310e888 100644
--- a/openbsc/include/openbsc/gsm_data_shared.h
+++ b/openbsc/include/openbsc/gsm_data_shared.h
@@ -537,9 +537,11 @@
sysinfo_buf_t si_buf[_MAX_SYSINFO_TYPE];
/* TimeZone hours, mins, and bts specific */
- int tzhr;
- int tzmn;
- int tz_bts_specific;
+ struct {
+ int hr;
+ int mn;
+ int override;
+ } tz;
/* ip.accesss Unit ID's have Site/BTS/TRX layout */
union {
diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c
index b38b08e..03ddfb7 100644
--- a/openbsc/src/libbsc/bsc_vty.c
+++ b/openbsc/src/libbsc/bsc_vty.c
@@ -448,8 +448,8 @@
VTY_NEWLINE);
vty_out(vty, " training_sequence_code %u%s", bts->tsc, VTY_NEWLINE);
vty_out(vty, " base_station_id_code %u%s", bts->bsic, VTY_NEWLINE);
- if (bts->tz_bts_specific != 0)
- vty_out(vty, " timezone %d %d%s", bts->tzhr, bts->tzmn, VTY_NEWLINE);
+ if (bts->tz.override != 0)
+ vty_out(vty, " timezone %d %d%s", bts->tz.hr, bts->tz.mn, VTY_NEWLINE);
vty_out(vty, " ms max power %u%s", bts->ms_max_power, VTY_NEWLINE);
vty_out(vty, " cell reselection hysteresis %u%s",
bts->si_common.cell_sel_par.cell_resel_hyst*2, VTY_NEWLINE);
@@ -1543,9 +1543,9 @@
int tzhr = atoi(argv[0]);
int tzmn = atoi(argv[1]);
- bts->tzhr = tzhr;
- bts->tzmn = tzmn;
- bts->tz_bts_specific=1;
+ bts->tz.hr = tzhr;
+ bts->tz.mn = tzmn;
+ bts->tz.override = 1;
return CMD_SUCCESS;
}
@@ -1556,7 +1556,9 @@
"disable bts specific timezone\n")
{
struct gsm_bts *bts = vty->index;
- bts->tz_bts_specific=0;
+
+ bts->tz.override = 0;
+
return CMD_SUCCESS;
}
diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c
index 9bdc39c..c868d7c 100644
--- a/openbsc/src/libmsc/gsm_04_08.c
+++ b/openbsc/src/libmsc/gsm_04_08.c
@@ -717,18 +717,18 @@
ptr8[5] = bcdify(gmt_time->tm_min);
ptr8[6] = bcdify(gmt_time->tm_sec);
- if (bts->tz_bts_specific) {
- /* Convert tzhr and tzmn to units */
- if (bts->tzhr < 0) {
- tzunits = ((bts->tzhr/-1)*4);
- tzunits = tzunits + (bts->tzmn/15);
+ if (bts->tz.override) {
+ /* Convert tz.hr and tz.mn to units */
+ if (bts->tz.hr < 0) {
+ tzunits = ((bts->tz.hr/-1)*4);
+ tzunits = tzunits + (bts->tz.mn/15);
ptr8[7] = bcdify(tzunits);
/* Set negative time */
ptr8[7] |= 0x08;
}
else {
- tzunits = bts->tzhr*4;
- tzunits = tzunits + (bts->tzmn/15);
+ tzunits = bts->tz.hr*4;
+ tzunits = tzunits + (bts->tz.mn/15);
ptr8[7] = bcdify(tzunits);
}
}