FreeCalypso > hg > sms-coding-utils
view gen-pdu/auto_scts.c @ 33:a91fb88a57b2 default tip
add INSTALL document
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 14 Jun 2024 20:29:17 +0000 |
parents | 003660a57f99 |
children |
line wrap: on
line source
/* * This module implements automatic generation of SC-Timestamp * based on the current time. */ #include <sys/types.h> #include <stdio.h> #include <time.h> extern u_char scts_buf[7]; extern int scts_is_set; void set_auto_scts() { time_t unixtime; struct tm *tm; char timestr[32]; time(&unixtime); tm = localtime(&unixtime); sprintf(timestr, "%02d/%02d/%02d,%02d:%02d:%02d%+03d", tm->tm_year % 100, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, tm->tm_gmtoff / (15*60)); encode_gsm_sms_abstime(timestr, scts_buf); scts_is_set = 1; }