time.c revision 28b863e609ff2d97b78663b46894494cfa2ea411
/*
* Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1998-2001, 2003 Internet Software Consortium.
*
* 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.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: time.c,v 1.38 2004/03/16 05:52:22 marka Exp $ */
#include <config.h>
#include <errno.h>
#include <limits.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <windows.h>
#include <isc/assertions.h>
/*
* struct FILETIME uses "100-nanoseconds intervals".
* NS / S = 1000000000 (10^9).
* While it is reasonably obvious that this makes the needed
* conversion factor 10^7, it is coded this way for additional clarity.
*/
#define NS_PER_S 1000000000
#define NS_INTERVAL 100
#define UINT64_MAX _UI64_MAX
/***
*** Absolute Times
***/
static isc_time_t epoch = { { 0, 0 } };
/***
*** Intervals
***/
static isc_interval_t zero_interval = { 0 };
void
unsigned int nanoseconds)
{
+ nanoseconds / NS_INTERVAL;
}
isc_interval_iszero(const isc_interval_t *i) {
if (i->interval == 0)
return (ISC_TRUE);
return (ISC_FALSE);
}
void
t->absolute.dwLowDateTime = 0;
t->absolute.dwHighDateTime = 0;
}
isc_time_isepoch(const isc_time_t *t) {
if (t->absolute.dwLowDateTime == 0 &&
t->absolute.dwHighDateTime == 0)
return (ISC_TRUE);
return (ISC_FALSE);
}
isc_time_now(isc_time_t *t) {
return (ISC_R_SUCCESS);
}
return (ISC_R_RANGE);
return (ISC_R_SUCCESS);
}
int
}
{
return (ISC_R_RANGE);
return (ISC_R_SUCCESS);
}
isc_time_t *result) {
return (ISC_R_RANGE);
return (ISC_R_SUCCESS);
}
return (0);
/*
* Convert to microseconds.
*/
return (i3);
}
isc_time_seconds(const isc_time_t *t) {
/*
* Convert the time to a SYSTEMTIME structure and the grab the
* milliseconds
*/
}
isc_time_nanoseconds(const isc_time_t *t) {
/*
* Convert the time to a SYSTEMTIME structure and the grab the
* milliseconds
*/
}
void
char DateBuf[50];
char TimeBuf[50];
static const char badtime[] = "99-Bad-9999 99:99:99.999";
DateBuf, 50);
} else
}