add current time in EMM information NAS mssage

This commit is contained in:
Sukchan Lee 2017-04-14 21:18:32 +09:00
parent a3ead1361c
commit 3098af0cfe
2 changed files with 29 additions and 6 deletions

View File

@ -548,15 +548,19 @@ typedef c_uint8_t nas_time_zone_t;
/* 9.9.3.30 Time zone and time
* See subclause 10.5.3.9 in 3GPP TS 24.008 [13].
* 9.2.3.11 TPServiceCentreTimeStamp (TPSCTS) in 3GPP TS 23.040 [90]
* O TV 8 */
#define NAS_TIME_TO_BCD(x) \
(((((x) % 10) << 4) & 0xf0) | (((x) / 10) & 0x0f))
typedef struct _nas_time_zone_and_time_t {
c_uint8_t year;
c_uint8_t month;
c_uint8_t day;
c_uint8_t mon;
c_uint8_t mday;
c_uint8_t hour;
c_uint8_t minute;
c_uint8_t second;
c_uint8_t time_zone;
c_uint8_t min;
c_uint8_t sec;
ED2(c_uint8_t sign:1;,
c_uint8_t gmtoff:7;) /* quarters of an hour */
} nas_time_zone_and_time_t;
/* 9.9.3.31 TMSI status

View File

@ -278,6 +278,9 @@ void emm_handle_attach_complete(
nas_daylight_saving_time_t *network_daylight_saving_time =
&emm_information->network_daylight_saving_time;
time_exp_t time_exp;
time_exp_lt(&time_exp, time_now());
d_assert(ue, return, "Null param");
enb = ue->enb;
d_assert(enb, return, "Null param");
@ -295,7 +298,23 @@ void emm_handle_attach_complete(
emm_information->presencemask |=
NAS_EMM_INFORMATION_UNIVERSAL_TIME_AND_LOCAL_TIME_ZONE_PRESENT;
universal_time_and_local_time_zone->year = 0;
universal_time_and_local_time_zone->year =
NAS_TIME_TO_BCD(time_exp.tm_year % 100);
universal_time_and_local_time_zone->mon = NAS_TIME_TO_BCD(time_exp.tm_mon);
universal_time_and_local_time_zone->mday =
NAS_TIME_TO_BCD(time_exp.tm_mday);
universal_time_and_local_time_zone->hour =
NAS_TIME_TO_BCD(time_exp.tm_hour);
universal_time_and_local_time_zone->min = NAS_TIME_TO_BCD(time_exp.tm_min);
universal_time_and_local_time_zone->sec = NAS_TIME_TO_BCD(time_exp.tm_sec);
if (time_exp.tm_gmtoff > 0)
universal_time_and_local_time_zone->sign = 0;
else
universal_time_and_local_time_zone->sign = 1;
/* quarters of an hour */
universal_time_and_local_time_zone->gmtoff =
NAS_TIME_TO_BCD(time_exp.tm_gmtoff / 900);
emm_information->presencemask |=
NAS_EMM_INFORMATION_NETWORK_DAYLIGHT_SAVING_TIME_PRESENT;
network_daylight_saving_time->length = 1;