/* We use this function rather than a BASE_CUSTOM formatter because BASE_CUSTOM doesn't support passing a 64-bit value to the formatting function.  */
static void ouch_tree_add_timestamp(proto_tree *tree, const int hf, tvbuff_t *tvb, gint offset)
/* We use this function rather than a BASE_CUSTOM formatter because BASE_CUSTOM doesn't support passing a 64-bit value to the formatting function.  */
static void ouch_tree_add_timestamp(proto_tree *tree, const int hf, tvbuff_t *tvb, gint offset)
{
    guint64 ts = tvb_get_ntoh64(tvb, offset);
    char *buf = (char *)wmem_alloc(wmem_packet_scope(), ITEM_LABEL_LENGTH);
    guint32 tmp, hours, mins, secs, nsecs;
    nsecs = (guint32)(ts % G_GUINT64_CONSTANT(1000000000));
    tmp = (guint32)(ts / G_GUINT64_CONSTANT(1000000000));
    hours = tmp / 3600;
    mins = (tmp % 3600) / 60;
    secs = tmp % 60;
    g_snprintf(buf, ITEM_LABEL_LENGTH,
               "%u:%02u:%02u.%09u",
               hours, mins, secs, nsecs);
    proto_tree_add_string(tree, hf, tvb, offset, 8, buf);
}