time.c revision 70e5a7403f0e0a3bd292b8287c5fed5772c15270
/*
* Copyright (C) 2004, 2005, 2007 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: time.c,v 1.31 2007/06/19 23:47:16 tbox Exp $ */
/*! \file */
#include <config.h>
#include <stdio.h>
#include <time.h>
char buf[sizeof("YYYYMMDDHHMMSS")];
int secs;
unsigned int l;
REQUIRE(t >= 0);
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.
*/
start -= 0x7fffffff;
base = 0;
base += 0x80000000;
base += 0x80000000;
}
return (dns_time64_totext(t, target));
}
int secs;
int i;
do { \
return (ISC_R_RANGE); \
} while (0)
return (DNS_R_SYNTAX);
return (DNS_R_SYNTAX);
/*
* Calulate seconds since epoch.
*/
for (i = 0; i < (month - 1); i++)
value += 86400;
for (i = 1970; i < year; i++) {
}
return (ISC_R_SUCCESS);
}
if (result != ISC_R_SUCCESS)
return (result);
return (ISC_R_SUCCESS);
}