forked from osmocom/wireshark
epan: Add back ABSOLUTE_TIME_NTP_UTC representation
It is a special case the prints "NULL" if time is zero.
This commit is contained in:
parent
0d471d9fe9
commit
7e041118d8
|
@ -175,6 +175,10 @@ abs_time_to_str_ex(wmem_allocator_t *scope, const nstime_t *abs_time, field_disp
|
|||
|
||||
ws_assert(FIELD_DISPLAY_IS_ABSOLUTE_TIME(fmt));
|
||||
|
||||
if (fmt == ABSOLUTE_TIME_NTP_UTC && nstime_is_zero(abs_time)) {
|
||||
return wmem_strdup(scope, "NULL");
|
||||
}
|
||||
|
||||
tmp = get_fmt_broken_down_time(fmt, &abs_time->secs);
|
||||
if (tmp == NULL) {
|
||||
return wmem_strdup(scope, "Not representable");
|
||||
|
@ -197,6 +201,10 @@ abs_time_secs_to_str_ex(wmem_allocator_t *scope, const time_t abs_time_secs, fie
|
|||
|
||||
ws_assert(FIELD_DISPLAY_IS_ABSOLUTE_TIME(fmt));
|
||||
|
||||
if (fmt == ABSOLUTE_TIME_NTP_UTC && abs_time_secs == 0) {
|
||||
return wmem_strdup(scope, "NULL");
|
||||
}
|
||||
|
||||
tmp = get_fmt_broken_down_time(fmt, &abs_time_secs);
|
||||
if (tmp == NULL) {
|
||||
return wmem_strdup(scope, "Not representable");
|
||||
|
|
|
@ -30,13 +30,9 @@ void nstime_set_zero(nstime_t *nstime)
|
|||
}
|
||||
|
||||
/* is the given nstime_t currently zero? */
|
||||
gboolean nstime_is_zero(nstime_t *nstime)
|
||||
gboolean nstime_is_zero(const nstime_t *nstime)
|
||||
{
|
||||
if(nstime->secs == 0 && nstime->nsecs == 0) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
return nstime->secs == 0 && nstime->nsecs == 0;
|
||||
}
|
||||
|
||||
/* set the given nstime_t to (0,maxint) to mark it as "unset"
|
||||
|
|
|
@ -59,7 +59,7 @@ typedef struct {
|
|||
WS_DLL_PUBLIC void nstime_set_zero(nstime_t *nstime);
|
||||
|
||||
/** is the given nstime_t currently zero? */
|
||||
WS_DLL_PUBLIC gboolean nstime_is_zero(nstime_t *nstime);
|
||||
WS_DLL_PUBLIC gboolean nstime_is_zero(const nstime_t *nstime);
|
||||
|
||||
/** set the given nstime_t to (0,maxint) to mark it as "unset"
|
||||
* That way we can find the first frame even when a timestamp
|
||||
|
|
Loading…
Reference in New Issue