From c585828d2b872edba66f694efff7954a726dbba1 Mon Sep 17 00:00:00 2001
From: Alexander Lamaison <awl03@doc.ic.ac.uk>
Date: Fri, 12 Mar 2010 11:29:31 +0000
Subject: [PATCH] Fix gettimeofday to compile with Visual C++ 6.

Reported by Steven Van Ingelgem.
---
 src/misc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/misc.c b/src/misc.c
index 798b2e6..1935553 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -528,22 +528,22 @@ void _libssh2_list_insert(struct list_node *after, /* insert before this */
  */
 
 /* Offset between 1/1/1601 and 1/1/1970 in 100 nanosec units */
-#define _W32_FT_OFFSET (116444736000000000ULL)
+#define _W32_FT_OFFSET (116444736000000000)
 
 
 int __cdecl gettimeofday(struct timeval *tp,
                          void *tzp)
  {
   union {
-    unsigned long long ns100; /*time since 1 Jan 1601 in 100ns units */
+    unsigned __int64 ns100; /*time since 1 Jan 1601 in 100ns units */
     FILETIME ft;
   }  _now;
 
   if(tp)
     {
       GetSystemTimeAsFileTime (&_now.ft);
-      tp->tv_usec=(long)((_now.ns100 / 10ULL) % 1000000ULL );
-      tp->tv_sec= (long)((_now.ns100 - _W32_FT_OFFSET) / 10000000ULL);
+      tp->tv_usec=(long)((_now.ns100 / 10) % 1000000 );
+      tp->tv_sec= (long)((_now.ns100 - _W32_FT_OFFSET) / 10000000);
     }
   /* Always return 0 as per Open Group Base Specifications Issue 6.
      Do not set errno on error.  */