/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* The copyright in this file is taken from the original Leach
* & Salz UUID specification, from which this implementation
* is derived.
*/
/*
* Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc.
* Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. &
* Digital Equipment Corporation, Maynard, Mass. Copyright (c) 1998
* Microsoft. To anyone who acknowledges that this file is provided
* "AS IS" without any express or implied warranty: permission to use,
* copy, modify, and distribute this file for any purpose is hereby
* granted without fee, provided that the above copyright notices and
* this notice appears in all source code copies, and that none of the
* names of Open Software Foundation, Inc., Hewlett-Packard Company,
* or Digital Equipment Corporation be used in advertising or
* publicity pertaining to distribution of the software without
* specific, written prior permission. Neither Open Software
* Foundation, Inc., Hewlett-Packard Company, Microsoft, nor Digital
* Equipment Corporation makes any representations about the
* suitability of this software for any purpose.
*/
#include <stdlib.h>
#include <strings.h>
#include "uuid_misc.h"
void get_system_time(uuid_time_t *);
/*
* Name: get_current_time
*
* Description: get-current_time -- get time as 60 bit 100ns ticks
* since the beginning of unix time.
* Compensate for the fact that real clock resolution is
* less than 100ns.
*
* Returns: None.
*
*/
void
{
int done;
done = 0;
while (!done) {
/*
* if clock reading changed since last UUID generated...
*/
/*
* reset count of uuids generated with
* this clock reading
*/
uuids_this_tick = 0;
done = 1;
} else {
done = 1;
}
/*
* too many UUIDs for this gettimeofday call; spin
*/
}
/*
* add the count of uuids to low order bits of the clock reading
*/
}
/*
* Name: get_random
*
* Description: Gets a random number.
*
* Returns: nbytes of random information.
*
*/
get_random(void)
{
static int initted = 0;
long seed;
if (!initted) {
initted = 1;
}
return (mrand48());
}
/*
* Name: uuid_compare
*
* Description: Compares 2 uuid strings
*
* Returns: -1 if u1 < u2, 1 if u1 > u2 and 0 if both are equal
*/
int
{
}
/*
* Name: get_system_time
*
* Description: system dependent call to get the current system time.
* Returned as 100ns ticks since Oct 15, 1582, but
* resolution may be less than 100ns.
*
* Returns: None
*/
void
{
/*
* Offset between UUID formatted times and Unix formatted times.
* UUID UTC base time is October 15, 1582.
* Unix base time is January 1, 1970.
*/
*uuid_time += 0x01B21DD213814000ULL;
}