time.c revision 5eb91bd90e3ad3426e5e3213031556a737cf3809
/*
* Copyright (C) 1998-2001 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.
*/
/* $Id: time.c,v 1.24 2003/07/25 00:01:06 marka Exp $ */
#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);
}