aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-windows-common.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-04-20 13:41:07 -0700
committerGuy Harris <guy@alum.mit.edu>2015-04-20 20:41:38 +0000
commit94dc9cd113f5263a55ee86855a4642991f87a351 (patch)
tree4fcd83ef7a87f0fd5a7f6c490d548023940ff332 /epan/dissectors/packet-windows-common.c
parent4e9ff477d90bad4ecbdaa9d39af872cd21eda858 (diff)
Have a common routine to convert FILETIME to nstime_t.
We had several copies of that code; put it into a filetime_to_nstime() routine in wsutil, and call that common routine instead. Change-Id: I1eb5579c36c129ff8d23f9212285ab3f63be0f43 Reviewed-on: https://code.wireshark.org/review/8142 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/dissectors/packet-windows-common.c')
-rw-r--r--epan/dissectors/packet-windows-common.c38
1 files changed, 1 insertions, 37 deletions
diff --git a/epan/dissectors/packet-windows-common.c b/epan/dissectors/packet-windows-common.c
index 4d19ce8367..fd0d302f25 100644
--- a/epan/dissectors/packet-windows-common.c
+++ b/epan/dissectors/packet-windows-common.c
@@ -1109,20 +1109,6 @@ value_string_ext ms_country_codes_ext = VALUE_STRING_EXT_INIT(ms_country_codes);
/*module_t* module;*/
/*pref_t* sid_display_hex;*/
-#ifndef TIME_T_MIN
-#define TIME_T_MIN ((time_t) ((time_t)0 < (time_t) -1 ? (time_t) 0 \
- : ~ (time_t) 0 << (sizeof (time_t) * CHAR_BIT - 1)))
-#endif
-#ifndef TIME_T_MAX
-#define TIME_T_MAX ((time_t) (~ (time_t) 0 - TIME_T_MIN))
-#endif
-
-/*
- * Number of seconds between the UN*X epoch (January 1, 1970, 00:00:00 GMT)
- * and the Windows NT epoch (January 1, 1601, 00:00:00 "GMT").
- */
-#define TIME_FIXUP_CONSTANT G_GUINT64_CONSTANT(11644473600)
-
/*
* Translate an 8-byte FILETIME value, given as the upper and lower 32 bits,
* to an "nstime_t".
@@ -1147,12 +1133,6 @@ static gboolean
nt_time_to_nstime(guint32 filetime_high, guint32 filetime_low, nstime_t *tv, gboolean onesec_resolution)
{
guint64 d;
- gint64 secs;
- int nsecs;
- /* The next two lines are a fix needed for the
- broken SCO compiler. JRA. */
- time_t l_time_min = TIME_T_MIN;
- time_t l_time_max = TIME_T_MAX;
if (filetime_high == 0)
return FALSE;
@@ -1163,23 +1143,7 @@ nt_time_to_nstime(guint32 filetime_high, guint32 filetime_low, nstime_t *tv, gbo
d *= 10000000;
}
- /* Split into seconds and nanoseconds. */
- secs = d / 10000000;
- nsecs = (int)((d % 10000000)*100);
-
- /* Now adjust the seconds. */
- secs -= TIME_FIXUP_CONSTANT;
-
- if (!(l_time_min <= secs && secs <= l_time_max))
- return FALSE;
-
- /*
- * Get the time as seconds and nanoseconds.
- */
- tv->secs = (time_t) secs;
- tv->nsecs = nsecs;
-
- return TRUE;
+ return filetime_to_nstime(tv, d);
}
int