time.c revision 28a8f5b0de57d269cf2845c69cb6abe18cbd3b3a
/*
* Copyright (C) 2004, 2005, 2007, 2009-2012 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1998-2003 Internet Software Consortium.
*
* 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$ */
/*! \file */
#include <config.h>
#include <stdio.h>
#include <time.h>
#include <ctype.h>
char buf[sizeof("YYYYMMDDHHMMSS")];
int secs;
unsigned int l;
/*
* Warning. Do NOT use arguments with side effects with these macros.
*/
while (t < 0) {
return (ISC_R_RANGE);
t += secs;
}
t -= secs;
return (ISC_R_RANGE);
}
t -= secs;
}
while (86400 <= t) {
t -= 86400;
}
while (3600 <= t) {
t -= 3600;
}
while (60 <= t) {
t -= 60;
}
/* yyyy mm dd HH MM SS */
return (ISC_R_NOSPACE);
isc_buffer_add(target, l);
return (ISC_R_SUCCESS);
}
isc_int64_t t;
/*
* Adjust the time to the closest epoch. This should be changed
* to use a 64-bit counterpart to isc_stdtime_get() if one ever
* is defined, but even the current code is good until the year
* 2106.
*/
else
return (t);
}
}
int secs;
int i;
do { \
return (ISC_R_RANGE); \
} while (0)
return (DNS_R_SYNTAX);
/*
* Confirm the source only consists digits. sscanf() allows some
* minor exceptions.
*/
for (i = 0; i < 14; i++) {
return (DNS_R_SYNTAX);
}
return (DNS_R_SYNTAX);
/*
* Calculate seconds from epoch.
* Note: this uses a idealized calendar.
*/
for (i = 0; i < (month - 1); i++)
value += 86400;
if (year < 1970) {
for (i = 1969; i >= year; i--) {
}
} else {
for (i = 1970; i < year; i++) {
}
}
return (ISC_R_SUCCESS);
}
if (result != ISC_R_SUCCESS)
return (result);
return (ISC_R_SUCCESS);
}