Index: ossp-pkg/uuid/ChangeLog RCS File: /v/ossp/cvs/ossp-pkg/uuid/Attic/ChangeLog,v rcsdiff -q -kk '-r1.152' '-r1.153' -u '/v/ossp/cvs/ossp-pkg/uuid/Attic/ChangeLog,v' 2>/dev/null --- ChangeLog 2008/01/10 14:18:46 1.152 +++ ChangeLog 2008/02/21 08:58:44 1.153 @@ -13,6 +13,9 @@ Changes between 1.6.0 and 1.6.1 (19-May-2007 to xx-Jan-2008) + o Port to Win32 API. + [Hiroshi Saito, Wu Yongwei, Ralf S. Engelschall] + o Adjust copyright messages for new year 2008. [Ralf S. Engelschall] @@ -23,7 +26,7 @@ of assigning to bytea->v_len under PostgreSQL >= 8.3 [Ralf S. Engelschall] - o Upgrade build environment to GNU libtool 1.5.24 + o Upgrade build environment to GNU libtool 1.5.26 [Ralf S. Engelschall] Changes between 1.5.1 and 1.6.0 (31-Jul-2006 to 19-May-2007) Index: ossp-pkg/uuid/Makefile.in RCS File: /v/ossp/cvs/ossp-pkg/uuid/Attic/Makefile.in,v rcsdiff -q -kk '-r1.45' '-r1.46' -u '/v/ossp/cvs/ossp-pkg/uuid/Attic/Makefile.in,v' 2>/dev/null --- Makefile.in 2008/01/10 14:18:46 1.45 +++ Makefile.in 2008/02/21 08:58:45 1.46 @@ -63,7 +63,7 @@ PG_CONFIG = @PG_CONFIG@ LIB_NAME = libuuid.la -LIB_OBJS = uuid.lo uuid_md5.lo uuid_sha1.lo uuid_prng.lo uuid_mac.lo uuid_ui64.lo uuid_ui128.lo uuid_str.lo +LIB_OBJS = uuid.lo uuid_md5.lo uuid_sha1.lo uuid_prng.lo uuid_mac.lo uuid_time.lo uuid_ui64.lo uuid_ui128.lo uuid_str.lo DCE_NAME = libuuid_dce.la DCE_OBJS = uuid_dce.lo $(LIB_OBJS) Index: ossp-pkg/uuid/THANKS RCS File: /v/ossp/cvs/ossp-pkg/uuid/Attic/THANKS,v rcsdiff -q -kk '-r1.13' '-r1.14' -u '/v/ossp/cvs/ossp-pkg/uuid/Attic/THANKS,v' 2>/dev/null --- THANKS 2007/01/01 18:39:52 1.13 +++ THANKS 2008/02/21 08:58:45 1.14 @@ -21,7 +21,9 @@ o Roman Neuhauser o Hrvoje Niksic o Piotr Roszatycki + o Hiroshi Saito o Michael Schloh o Guerry Semones o David Wheeler + o Wu Yongwei Index: ossp-pkg/uuid/uuid.ac RCS File: /v/ossp/cvs/ossp-pkg/uuid/Attic/uuid.ac,v rcsdiff -q -kk '-r1.23' '-r1.24' -u '/v/ossp/cvs/ossp-pkg/uuid/Attic/uuid.ac,v' 2>/dev/null --- uuid.ac 2008/01/10 14:18:46 1.23 +++ uuid.ac 2008/02/21 08:58:45 1.24 @@ -43,7 +43,7 @@ AC_CHECK_VA_COPY() dnl # check for system headers - AC_CHECK_HEADERS(sys/types.h sys/param.h sys/time.h sys/socket.h sys/sockio.h sys/ioctl.h) + AC_CHECK_HEADERS(sys/types.h sys/param.h sys/time.h sys/socket.h sys/sockio.h sys/ioctl.h sys/select.h) AC_CHECK_HEADERS(netdb.h ifaddrs.h net/if.h net/if_dl.h net/if_arp.h netinet/in.h arpa/inet.h,,, [[ #if HAVE_SYS_TYPES_H @@ -58,7 +58,7 @@ ]]) dnl # check for functions - AC_CHECK_FUNCS(getifaddrs nanosleep) + AC_CHECK_FUNCS(getifaddrs nanosleep Sleep) dnl # check size of built-in types AC_CHECK_TYPES([long long, long double]) Index: ossp-pkg/uuid/uuid.c RCS File: /v/ossp/cvs/ossp-pkg/uuid/Attic/uuid.c,v rcsdiff -q -kk '-r1.65' '-r1.66' -u '/v/ossp/cvs/ossp-pkg/uuid/Attic/uuid.c,v' 2>/dev/null --- uuid.c 2008/01/10 14:18:46 1.65 +++ uuid.c 2008/02/21 08:58:45 1.66 @@ -49,6 +49,7 @@ #include "uuid_sha1.h" #include "uuid_prng.h" #include "uuid_mac.h" +#include "uuid_time.h" #include "uuid_ui64.h" #include "uuid_ui128.h" #include "uuid_str.h" @@ -873,11 +874,6 @@ static uuid_rc_t uuid_make_v1(uuid_t *uuid, unsigned int mode, va_list ap) { struct timeval time_now; -#ifdef HAVE_NANOSLEEP - struct timespec ts; -#else - struct timeval tv; -#endif ui64_t t; ui64_t offset; ui64_t ov; @@ -890,7 +886,7 @@ /* determine current system time and sequence counter */ for (;;) { /* determine current system time */ - if (gettimeofday(&time_now, NULL) == -1) + if (time_gettimeofday(&time_now, NULL) == -1) return UUID_RC_SYS; /* check whether system time changed since last retrieve */ @@ -910,17 +906,7 @@ /* stall the UUID generation until the system clock (which has a gettimeofday(2) resolution of 1us) catches up */ -#ifdef HAVE_NANOSLEEP - /* sleep for 500ns (1/2us) */ - ts.tv_sec = 0; - ts.tv_nsec = 500; - nanosleep(&ts, NULL); -#else - /* sleep for 1000ns (1us) */ - tv.tv_sec = 0; - tv.tv_usec = 1; - select(0, NULL, NULL, NULL, &tv); -#endif + time_usleep(1); } /* convert from timeval (sec,usec) to OSSP ui64 (100*nsec) format */ Index: ossp-pkg/uuid/uuid_prng.c RCS File: /v/ossp/cvs/ossp-pkg/uuid/Attic/uuid_prng.c,v rcsdiff -q -kk '-r1.16' '-r1.17' -u '/v/ossp/cvs/ossp-pkg/uuid/Attic/uuid_prng.c,v' 2>/dev/null --- uuid_prng.c 2008/01/10 14:18:47 1.16 +++ uuid_prng.c 2008/02/21 08:58:45 1.17 @@ -50,7 +50,9 @@ prng_rc_t prng_create(prng_t **prng) { +#if !defined(WIN32) int fd = -1; +#endif struct timeval tv; pid_t pid; unsigned int i; @@ -65,12 +67,14 @@ /* try to open the system PRNG device */ (*prng)->dev = -1; +#if !defined(WIN32) if ((fd = open("/dev/urandom", O_RDONLY)) == -1) fd = open("/dev/random", O_RDONLY|O_NONBLOCK); if (fd != -1) { (void)fcntl(fd, F_SETFD, FD_CLOEXEC); (*prng)->dev = fd; } +#endif /* initialize MD5 engine */ if (md5_create(&((*prng)->md5)) != MD5_RC_OK) { Index: ossp-pkg/uuid/uuid_time.c RCS File: /v/ossp/cvs/ossp-pkg/uuid/Attic/uuid_time.c,v co -q -kk -p'1.1' '/v/ossp/cvs/ossp-pkg/uuid/Attic/uuid_time.c,v' | diff -u /dev/null - -L'ossp-pkg/uuid/uuid_time.c' 2>/dev/null --- ossp-pkg/uuid/uuid_time.c +++ - 2024-05-17 18:51:15.374941313 +0200 @@ -0,0 +1,114 @@ +/* +** OSSP uuid - Universally Unique Identifier +** Copyright (c) 2004-2008 Ralf S. Engelschall +** Copyright (c) 2004-2008 The OSSP Project +** +** This file is part of OSSP uuid, a library for the generation +** of UUIDs which can found at http://www.ossp.org/pkg/lib/uuid/ +** +** Permission to use, copy, modify, and distribute this software for +** any purpose with or without fee is hereby granted, provided that +** the above copyright notice and this permission notice appear in all +** copies. +** +** THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED +** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +** IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR +** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +** SUCH DAMAGE. +** +** uuid_time.c: Time Management +*/ + +/* own headers (part (1/2) */ +#include "uuid_ac.h" + +/* system headers */ +#include +#include +#include +#ifdef HAVE_SYS_TIME_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SELECT_H +#include +#endif + +/* own headers (part (1/2) */ +#include "uuid_time.h" + +/* POSIX gettimeofday(2) abstraction */ +int time_gettimeofday(struct timeval *tv, struct timezone *tz) +{ +#if defined(WIN32) + /* Windows emulation */ + FILETIME ft; + LARGE_INTEGER li; + __int64 t; + static int tzflag; + +#if !defined(__GNUC__) +#define EPOCHFILETIME 116444736000000000i64 +#else +#define EPOCHFILETIME 116444736000000000LL +#endif + if (tv != NULL) { + GetSystemTimeAsFileTime(&ft); + li.LowPart = ft.dwLowDateTime; + li.HighPart = ft.dwHighDateTime; + t = li.QuadPart; + t -= EPOCHFILETIME; + t /= 10; + tv->tv_sec = (long)(t / 1000000); + tv->tv_usec = (long)(t % 1000000); + } + if (tz != NULL) { + if (!tzflag) { + _tzset(); + tzflag++; + } + tz->tz_minuteswest = _timezone / 60; + tz->tz_dsttime = _daylight; + } + return 0; +#else + /* POSIX pass-through */ + return gettimeofday(tv, tz); +#endif +} + +/* BSD usleep(3) abstraction */ +int time_usleep(long usec) +{ +#if defined(WIN32) && defined(HAVE_SLEEP) + /* Win32 newer Sleep(3) variant */ + Sleep(usec / 1000); +#elif defined(WIN32) + /* Win32 older _sleep(3) variant */ + _sleep(usec / 1000); +#elif defined(HAVE_NANOSLEEP) + /* POSIX newer nanosleep(3) variant */ + struct timespec ts; + ts.tv_sec = 0; + ts.tv_nsec = 1000 * usec; + nanosleep(&ts, NULL); +#else + /* POSIX older select(2) variant */ + struct timeval tv; + tv.tv_sec = 0; + tv.tv_usec = usec; + select(0, NULL, NULL, NULL, &tv); +#endif + return 0; +} + Index: ossp-pkg/uuid/uuid_time.h RCS File: /v/ossp/cvs/ossp-pkg/uuid/Attic/uuid_time.h,v co -q -kk -p'1.1' '/v/ossp/cvs/ossp-pkg/uuid/Attic/uuid_time.h,v' | diff -u /dev/null - -L'ossp-pkg/uuid/uuid_time.h' 2>/dev/null --- ossp-pkg/uuid/uuid_time.h +++ - 2024-05-17 18:51:15.377610664 +0200 @@ -0,0 +1,56 @@ +/* +** OSSP uuid - Universally Unique Identifier +** Copyright (c) 2004-2008 Ralf S. Engelschall +** Copyright (c) 2004-2008 The OSSP Project +** +** This file is part of OSSP uuid, a library for the generation +** of UUIDs which can found at http://www.ossp.org/pkg/lib/uuid/ +** +** Permission to use, copy, modify, and distribute this software for +** any purpose with or without fee is hereby granted, provided that +** the above copyright notice and this permission notice appear in all +** copies. +** +** THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED +** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +** IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR +** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +** SUCH DAMAGE. +** +** uuid_time.h: Time Management API +*/ + +#ifndef __UUID_TIME_H__ +#define __UUID_TIME_H__ + +#include "uuid_ac.h" + +#if defined(WIN32) +#define WIN32_LEAN_AND_MEAN +#include +#endif +#include +#ifdef HAVE_SYS_TIME_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#if defined(WIN32) +struct timeval { long tv_sec; long tv_usec; }; +struct timezone { int tz_minuteswest; int tz_dsttime; }; +#endif + +extern int time_gettimeofday(struct timeval *, struct timezone *); +extern int time_usleep(long usec); + +#endif /* __UUID_TIME_H__ */ +