summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2012-07-08 16:48:11 +0200
committerHarald Welte <laforge@gnumonks.org>2012-07-13 14:24:28 +0200
commit2d693594e2d01a4ee97829b2593d7941a67333ce (patch)
tree09174383a003faf27b0c284c0d91e31287b25efc
parentc52eac548fc6c6ac97d35441d1bf55916413c31d (diff)
move BTS-specific timezone override into sub-structure
Group all three structure members involved in bts-specific timezone handling into a sub-structure.
-rw-r--r--openbsc/include/openbsc/gsm_data_shared.h8
-rw-r--r--openbsc/src/libbsc/bsc_vty.c14
-rw-r--r--openbsc/src/libmsc/gsm_04_08.c14
3 files changed, 20 insertions, 16 deletions
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 @@ struct gsm_bts {
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 @@ static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
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 @@ DEFUN(cfg_bts_timezone,
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 @@ DEFUN(cfg_bts_no_timezone,
"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 @@ int gsm48_tx_mm_info(struct gsm_subscriber_connection *conn)
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);
}
}