time.c revision 585529aaeb95a71cd3d95df2602a4688fc7c3292
/*
* Copyright (C) 1998, 1999, 2000 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 INTERNET SOFTWARE CONSORTIUM DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM 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.
*/
#include <config.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <errno.h>
#include <windows.h>
#include <isc/assertions.h>
/*
* struct FILETIME uses "100-nanoseconds intevals".
* 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
/***
*** Intervals
***/
static isc_interval_t zero_interval = { 0 };
void
unsigned int seconds, unsigned int nanoseconds) {
/*
* Set 'i' to a value representing an interval of 'seconds' seconds
* and 'nanoseconds' nanoseconds, suitable for use in isc_time_add()
* and isc_time_subtract().
*/
+ nanoseconds / NS_INTERVAL;
}
/*
* Returns ISC_TRUE iff. 'i' is the zero interval.
*/
if (i->interval == 0)
return (ISC_TRUE);
return (ISC_FALSE);
}
/***
*** Absolute Times
***/
static isc_time_t epoch = { 0, 0 };
void
/*
* Set 't' to a particular number of seconds + nanoseconds since the
* epoch.
*/
+ nanoseconds / NS_INTERVAL;
}
void
/*
* Set 't' to the time of the epoch.
*/
t->absolute.dwLowDateTime = 0;
t->absolute.dwHighDateTime = 0;
}
isc_time_isepoch(isc_time_t *t) {
/*
* Returns ISC_TRUE iff. 't' is the epoch ("time zero").
*/
if (t->absolute.dwLowDateTime == 0 &&
t->absolute.dwHighDateTime == 0)
return (ISC_TRUE);
return (ISC_FALSE);
}
isc_time_now(isc_time_t *t) {
/*
* Set *t to the current absolute time.
*/
return (ISC_R_SUCCESS);
}
/*
* Set *t to the current absolute time + i.
*/
return (ISC_R_SUCCESS);
}
int
/*
* Compare the times referenced by 't1' and 't2'
*/
}
void
/*
* Add 't' to 'i', storing the result in 'result'.
*/
}
void
/*
* Subtract 'i' from 't', storing the result in 'result'.
*/
}
return (0);
/*
* Convert to microseconds.
*/
return (i3);
}
isc_time_seconds(isc_time_t *t) {
}
i.QuadPart -= isc_time_seconds(t);
}