time.c revision 09b9db3c91786130fc095df5055098964e7cdb83
/*
* Copyright (C) 1998-2001, 2003, 2004, 2006-2009, 2012-2018 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* $Id: time.c,v 1.52 2009/08/14 07:51:08 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 const isc_time_t epoch = { { 0, 0 } };
/***
*** Intervals
***/
static const isc_interval_t zero_interval = { 0 };
void
unsigned int nanoseconds)
{
/*
* This rounds nanoseconds up not down.
*/
}
isc_interval_iszero(const isc_interval_t *i) {
if (i->interval == 0)
return (ISC_TRUE);
return (ISC_FALSE);
}
void
}
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) {
return ((isc_uint32_t)i3);
}
INSIST(sizeof(unsigned int) == sizeof(isc_uint32_t));
return (ISC_R_RANGE);
return (ISC_R_SUCCESS);
}
isc_time_nanoseconds(const isc_time_t *t) {
}
void
char DateBuf[50];
char TimeBuf[50];
DateBuf, 50);
} else {
}
}
void
char DateBuf[50];
char TimeBuf[50];
/* strftime() format: "%a, %d %b %Y %H:%M:%S GMT" */
} else {
buf[0] = 0;
}
}
char *p;
if (p == NULL)
return (ISC_R_UNEXPECTED);
if (when == -1)
return (ISC_R_UNEXPECTED);
isc_time_set(t, (unsigned int)when, 0);
return (ISC_R_SUCCESS);
}
void
char DateBuf[50];
char TimeBuf[50];
/* strtime() format: "%Y-%m-%dT%H:%M:%SZ" */
DateBuf, 50);
} else {
buf[0] = 0;
}
}
void
char DateBuf[50];
char TimeBuf[50];
/* strtime() format: "%Y-%m-%dT%H:%M:%S.SSSZ" */
DateBuf, 50);
} else {
buf[0] = 0;
}
}