Wireshark 2.9.0-477-g68ec514b The Wireshark network protocol analyzer

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

nstime.h
Go to the documentation of this file.
1 /* nstime.h
2 * Definition of data structure to hold time values with nanosecond resolution
3 *
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
7 *
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
10
11 #ifndef __NSTIME_H__
12 #define __NSTIME_H__
13
14 #include <time.h>
15
16 #include "ws_symbol_export.h"
17
18 #ifdef __cplusplus
19 extern "C" {
20 #endif /* __cplusplus */
21
27 typedef struct {
28 time_t secs;
29 int nsecs;
30 } nstime_t;
31
32 /* functions */
33
35 WS_DLL_PUBLIC void nstime_set_zero(nstime_t *nstime);
36
38 WS_DLL_PUBLIC gboolean nstime_is_zero(nstime_t *nstime);
39
44 WS_DLL_PUBLIC void nstime_set_unset(nstime_t *nstime);
45
46 /* is the given nstime_t currently (0,maxint)? */
47 WS_DLL_PUBLIC gboolean nstime_is_unset(const nstime_t *nstime);
48
53 WS_DLL_PUBLIC void nstime_copy(nstime_t *a, const nstime_t *b);
54
62 WS_DLL_PUBLIC void nstime_delta(nstime_t *delta, const nstime_t *b, const nstime_t *a );
63
71 WS_DLL_PUBLIC void nstime_sum(nstime_t *sum, const nstime_t *b, const nstime_t *a );
72
74 #define nstime_add(sum, a) nstime_sum(sum, sum, a)
75
77 #define nstime_subtract(sum, a) nstime_delta(sum, sum, a)
78
85 WS_DLL_PUBLIC int nstime_cmp (const nstime_t *a, const nstime_t *b );
86
88 WS_DLL_PUBLIC double nstime_to_msec(const nstime_t *nstime);
89
91 WS_DLL_PUBLIC double nstime_to_sec(const nstime_t *nstime);
92
95 WS_DLL_PUBLIC gboolean filetime_to_nstime(nstime_t *nstime, guint64 filetime);
96
100 WS_DLL_PUBLIC gboolean nsfiletime_to_nstime(nstime_t *nstime, guint64 nsfiletime);
101
102 #ifdef __cplusplus
103 }
104 #endif /* __cplusplus */
105
106 #endif /* __NSTIME_H__ */
nsfiletime_to_nstime
WS_DLL_PUBLIC gboolean nsfiletime_to_nstime(nstime_t *nstime, guint64 nsfiletime)
Definition: nstime.c:277
nstime_sum
WS_DLL_PUBLIC void nstime_sum(nstime_t *sum, const nstime_t *b, const nstime_t *a)
Definition: nstime.c:115
nstime_t
Definition: nstime.h:27
nstime_copy
WS_DLL_PUBLIC void nstime_copy(nstime_t *a, const nstime_t *b)
Definition: nstime.c:63
nstime_set_zero
WS_DLL_PUBLIC void nstime_set_zero(nstime_t *nstime)
Definition: nstime.c:22
nstime_set_unset
WS_DLL_PUBLIC void nstime_set_unset(nstime_t *nstime)
Definition: nstime.c:42
nstime_to_sec
WS_DLL_PUBLIC double nstime_to_sec(const nstime_t *nstime)
Definition: nstime.c:171
nstime_delta
WS_DLL_PUBLIC void nstime_delta(nstime_t *delta, const nstime_t *b, const nstime_t *a)
Definition: nstime.c:74
filetime_to_nstime
WS_DLL_PUBLIC gboolean filetime_to_nstime(nstime_t *nstime, guint64 filetime)
Definition: nstime.c:253
nstime_cmp
WS_DLL_PUBLIC int nstime_cmp(const nstime_t *a, const nstime_t *b)
Definition: nstime.c:136
nstime_is_zero
WS_DLL_PUBLIC gboolean nstime_is_zero(nstime_t *nstime)
Definition: nstime.c:29
nstime_to_msec
WS_DLL_PUBLIC double nstime_to_msec(const nstime_t *nstime)
Definition: nstime.c:161