* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: time.h,v 1.31 2007/06/19 23:47:20 tbox Exp $ */
+/* $Id: time.h,v 1.32 2008/09/08 06:53:10 marka Exp $ */
#ifndef ISC_TIME_H
#define ISC_TIME_H 1
LIBISC_EXTERNAL_DATA extern isc_time_t *isc_time_epoch;
+void
+isc_time_set(isc_time_t *t, unsigned int seconds, unsigned int nanoseconds);
+/*%<
+ * Set 't' to a value which represents the given number of seconds and
+ * nanoseconds since 00:00:00 January 1, 1970, UTC.
+ *
+ * Requires:
+ *\li 't' is a valid pointer.
+ *\li nanoseconds < 1000000000.
+ */
+
void
isc_time_settoepoch(isc_time_t *t);
/*
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: time.c,v 1.45 2008/08/29 23:47:22 tbox Exp $ */
+/* $Id: time.c,v 1.46 2008/09/08 06:53:10 marka Exp $ */
#include <config.h>
return (ISC_FALSE);
}
+void
+isc_time_set(isc_time_t *t, unsigned int seconds, unsigned int nanoseconds) {
+ SYSTEMTIME epoch = { 1970, 1, 4, 1, 0, 0, 0, 0 };
+ FILETIME temp;
+ ULARGE_INTEGER i1;
+
+ REQUIRE(t != NULL);
+ REQUIRE(nanoseconds < NS_PER_S);
+
+ SystemTimeToFileTime(&epoch, &temp);
+
+ i1.LowPart = t->absolute.dwLowDateTime;
+ i1.HighPart = t->absolute.dwHighDateTime;
+
+ i1.QuadPart += (unsigned __int64)nanoseconds/100;
+ i1.QuadPart += (unsigned __int64)seconds*10000000);
+
+ t->absolute.dwLowDateTime = i1.LowPart;
+ t->absolute.dwHighDateTime = i1.HighPart;
+}
+
void
isc_time_settoepoch(isc_time_t *t) {
REQUIRE(t != NULL);