move BTS-specific timezone override into sub-structure

Group all three structure members involved in bts-specific timezone
handling into a sub-structure.
This commit is contained in:
Harald Welte 2012-07-08 16:48:11 +02:00
parent 25cf824edc
commit 45f9171175
3 changed files with 20 additions and 16 deletions

View File

@ -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 {

View File

@ -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;
}

View File

@ -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);
}
}