apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mladen Turk" <mt...@mappingsoft.com>
Subject RE: cvs commit: apr/misc/win32 getuuid.c
Date Wed, 13 Feb 2002 07:46:40 GMT


> -----Original Message-----
> From: William A. Rowe, Jr. [mailto:wrowe@covalent.net] 
> Sent: Wednesday, February 13, 2002 3:10 AM
> To: Greg Stein; dev@apr.apache.org; Mladen Turk
> Subject: Re: cvs commit: apr/misc/win32 getuuid.c
> 
> 
> +1, Agreed and backed out.
> 
> Mladen - would you substitute the misc/unix implementation 
> and report back with a patch to that file only, if a patch is 
> required?  Otherwise, just the updated build files [zipped as 
> you had them] would be great.
> 
> Bill
> 
> ----- Original Message ----- 
> From: "Greg Stein" <gstein@lyra.org>
> To: <dev@apr.apache.org>
> Sent: Tuesday, February 12, 2002 7:07 PM
> Subject: Re: cvs commit: apr/misc/win32 getuuid.c
> 
> 
> > -1
> > 
> > The code should defer to the Unix version of getuuid.c. That has a 
> > much more robust implementation.
> > 
> > Cheers,
> > -g

Here it is...
The reference in EVC project should go to misc/unix/getuuid.c



Index: getuuid.c
===================================================================
RCS file: /home/cvspublic/apr/misc/unix/getuuid.c,v
retrieving revision 1.16
diff -u -r1.16 getuuid.c
--- getuuid.c	30 Nov 2001 22:26:54 -0000	1.16
+++ getuuid.c	13 Feb 2002 07:43:34 -0000
@@ -57,7 +57,9 @@
  * located at
http://www.webdav.org/specs/draft-leach-uuids-guids-01.txt
  */
 
+#if APR_HAVE_UNISTD_H
 #include <unistd.h>     /* for getpid, gethostname */
+#endif
 #include <stdlib.h>     /* for rand, srand */
 
 #include "apr.h"
@@ -100,7 +102,7 @@
     /* Leach & Salz use Linux-specific struct sysinfo;
      * replace with pid/tid for portability (in the spirit of
mod_unique_id) */
     struct {
-	/* Add thread id here, if applicable, when we get to pthread or
apr */
+    /* Add thread id here, if applicable, when we get to pthread or apr
*/
         pid_t pid;
 #ifdef NETWARE
         apr_uint64_t t;
@@ -144,6 +146,15 @@
     
     NXGetTime(NX_SINCE_1970, NX_SECONDS, &sec);
     *uuid_time = (sec * 10000000) + 0x01B21DD213814000LL;
+#elif _WIN32_WCE
+    SYSTEMTIME sys;
+    FILETIME   sec;
+    
+    GetSystemTime(&sys);
+    FileTimeToSystemTime(&sec, &sys);
+    *uuid_time = (apr_uint64_t)(sec.dwHighDateTime << 32);
+    *uuid_time |= (apr_uint64_t)(sec.dwLowDateTime);
+    *uuid_time += 5748192000000000i64;
 #else
     struct timeval tp;


MT. 


Mime
View raw message