mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-hlr.git
synced 2025-11-03 13:43:29 +00:00
change format of 'last LU seen'
So far, the time string format comes from ctime_r, and we manually add "UTC" to it. The ctime_r format is wildly chaotic IMHO, mixing weekday, day-of-month and hour and year in very unsorted ways. Adding "UTC" to it is non-standard. Instead use an ISO-8601 standardized time string via strftime(). Change-Id: I6731968f05050399f4dd43b241290186e0c59e1a
This commit is contained in:
@@ -35,16 +35,15 @@ struct vty;
|
|||||||
|
|
||||||
#define hexdump_buf(buf) osmo_hexdump_nospc((void*)buf, sizeof(buf))
|
#define hexdump_buf(buf) osmo_hexdump_nospc((void*)buf, sizeof(buf))
|
||||||
|
|
||||||
static char *
|
static char *get_datestr(const time_t *t)
|
||||||
get_datestr(const time_t *t, char *datebuf)
|
|
||||||
{
|
{
|
||||||
char *p, *s = ctime_r(t, datebuf);
|
static char buf[32];
|
||||||
|
struct tm tm;
|
||||||
|
|
||||||
/* Strip trailing newline. */
|
tm = *gmtime(t);
|
||||||
p = strchr(s, '\n');
|
|
||||||
if (p)
|
strftime(buf, sizeof(buf), "%FT%T+00:00", &tm);
|
||||||
*p = '\0';
|
return buf;
|
||||||
return s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void subscr_dump_full_vty(struct vty *vty, struct hlr_subscriber *subscr)
|
static void subscr_dump_full_vty(struct vty *vty, struct hlr_subscriber *subscr)
|
||||||
@@ -52,7 +51,6 @@ static void subscr_dump_full_vty(struct vty *vty, struct hlr_subscriber *subscr)
|
|||||||
int rc;
|
int rc;
|
||||||
struct osmo_sub_auth_data aud2g;
|
struct osmo_sub_auth_data aud2g;
|
||||||
struct osmo_sub_auth_data aud3g;
|
struct osmo_sub_auth_data aud3g;
|
||||||
char datebuf[26]; /* for ctime_r(3) */
|
|
||||||
|
|
||||||
vty_out(vty, " ID: %"PRIu64"%s", subscr->id, VTY_NEWLINE);
|
vty_out(vty, " ID: %"PRIu64"%s", subscr->id, VTY_NEWLINE);
|
||||||
|
|
||||||
@@ -79,7 +77,7 @@ static void subscr_dump_full_vty(struct vty *vty, struct hlr_subscriber *subscr)
|
|||||||
if (subscr->ms_purged_ps)
|
if (subscr->ms_purged_ps)
|
||||||
vty_out(vty, " PS purged%s", VTY_NEWLINE);
|
vty_out(vty, " PS purged%s", VTY_NEWLINE);
|
||||||
if (subscr->last_lu_seen)
|
if (subscr->last_lu_seen)
|
||||||
vty_out(vty, " last LU seen: %s UTC%s", get_datestr(&subscr->last_lu_seen, datebuf), VTY_NEWLINE);
|
vty_out(vty, " last LU seen: %s%s", get_datestr(&subscr->last_lu_seen), VTY_NEWLINE);
|
||||||
|
|
||||||
if (!*subscr->imsi)
|
if (!*subscr->imsi)
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user