comparison gen-pdu/auto_scts.c @ 9:003660a57f99

new program sms-gen-tpdu
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 05 Aug 2023 07:43:45 +0000
parents
children
comparison
equal deleted inserted replaced
8:265b8103530c 9:003660a57f99
1 /*
2 * This module implements automatic generation of SC-Timestamp
3 * based on the current time.
4 */
5
6 #include <sys/types.h>
7 #include <stdio.h>
8 #include <time.h>
9
10 extern u_char scts_buf[7];
11 extern int scts_is_set;
12
13 void
14 set_auto_scts()
15 {
16 time_t unixtime;
17 struct tm *tm;
18 char timestr[32];
19
20 time(&unixtime);
21 tm = localtime(&unixtime);
22 sprintf(timestr, "%02d/%02d/%02d,%02d:%02d:%02d%+03d",
23 tm->tm_year % 100, tm->tm_mon + 1, tm->tm_mday,
24 tm->tm_hour, tm->tm_min, tm->tm_sec, tm->tm_gmtoff / (15*60));
25 encode_gsm_sms_abstime(timestr, scts_buf);
26 scts_is_set = 1;
27 }