diff options
author | Harald Welte <laforge@gnumonks.org> | 2012-07-08 16:48:11 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2012-07-12 01:14:28 +0200 |
commit | 45f9171175fba99fff594465cb85d596212b5cac (patch) | |
tree | 42d7a1123ecd3c4ea54c4857575550c2f3dda24b | |
parent | 25cf824edc5e7b548824b00abb91922243b5b6b5 (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.h | 8 | ||||
-rw-r--r-- | openbsc/src/libbsc/bsc_vty.c | 14 | ||||
-rw-r--r-- | openbsc/src/libmsc/gsm_04_08.c | 14 |
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 7db41c3dd..310e8886b 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 b38b08e1f..03ddfb7d9 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 9bdc39cc8..c868d7cc0 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); } } |