Fix wsutil/time_util.c indentation

This commit is contained in:
João Valverde 2021-12-17 18:29:53 +00:00 committed by Wireshark GitLab Utility
parent d443197097
commit b83f264f7d
1 changed files with 36 additions and 37 deletions

View File

@ -161,53 +161,52 @@ void log_resource_usage(gboolean reset_delta, const char *format, ...) {
/* Copied from pcapio.c pcapng_write_interface_statistics_block()*/ /* Copied from pcapio.c pcapng_write_interface_statistics_block()*/
guint64 guint64
create_timestamp(void) { create_timestamp(void) {
guint64 timestamp; guint64 timestamp;
#ifdef _WIN32 #ifdef _WIN32
FILETIME now; FILETIME now;
#else #else
struct timeval now; struct timeval now;
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
/* /*
* Current time, represented as 100-nanosecond intervals since * Current time, represented as 100-nanosecond intervals since
* January 1, 1601, 00:00:00 UTC. * January 1, 1601, 00:00:00 UTC.
* *
* I think DWORD might be signed, so cast both parts of "now" * I think DWORD might be signed, so cast both parts of "now"
* to guint32 so that the sign bit doesn't get treated specially. * to guint32 so that the sign bit doesn't get treated specially.
* *
* Windows 8 provides GetSystemTimePreciseAsFileTime which we * Windows 8 provides GetSystemTimePreciseAsFileTime which we
* might want to use instead. * might want to use instead.
*/ */
GetSystemTimeAsFileTime(&now); GetSystemTimeAsFileTime(&now);
timestamp = (((guint64)(guint32)now.dwHighDateTime) << 32) + timestamp = (((guint64)(guint32)now.dwHighDateTime) << 32) +
(guint32)now.dwLowDateTime; (guint32)now.dwLowDateTime;
/* /*
* Convert to same thing but as 1-microsecond, i.e. 1000-nanosecond, * Convert to same thing but as 1-microsecond, i.e. 1000-nanosecond,
* intervals. * intervals.
*/ */
timestamp /= 10; timestamp /= 10;
/* /*
* Subtract difference, in microseconds, between January 1, 1601 * Subtract difference, in microseconds, between January 1, 1601
* 00:00:00 UTC and January 1, 1970, 00:00:00 UTC. * 00:00:00 UTC and January 1, 1970, 00:00:00 UTC.
*/ */
timestamp -= EPOCH_DELTA_1601_01_01_00_00_00_UTC*1000000; timestamp -= EPOCH_DELTA_1601_01_01_00_00_00_UTC*1000000;
#else #else
/* /*
* Current time, represented as seconds and microseconds since * Current time, represented as seconds and microseconds since
* January 1, 1970, 00:00:00 UTC. * January 1, 1970, 00:00:00 UTC.
*/ */
gettimeofday(&now, NULL); gettimeofday(&now, NULL);
/* /*
* Convert to delta in microseconds. * Convert to delta in microseconds.
*/ */
timestamp = (guint64)(now.tv_sec) * 1000000 + timestamp = (guint64)(now.tv_sec) * 1000000 + (guint64)(now.tv_usec);
(guint64)(now.tv_usec);
#endif #endif
return timestamp; return timestamp;
} }
struct timespec * struct timespec *