time.c revision 7d32c065c7bb56f281651ae3dd2888f32ce4f1d9
/*
* Copyright (C) 1998, 1999, 2000 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.6 2000/02/03 23:44:00 halley Exp $ */
#include <config.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <isc/assertions.h>
char buf[sizeof "YYYYMMDDHHMMSS"];
int secs;
unsigned int l;
REQUIRE(t >= 0);
t -= secs;
return DNS_R_RANGE;
}
t -= secs;
}
while (86400 <= t) {
t -= 86400;
}
while (3600 <= t) {
t -= 3600;
}
while (60 <= t) {
t -= 60;
}
/* yy mm dd HH MM SS */
return (DNS_R_NOSPACE);
isc_buffer_add(target, l);
return (DNS_R_SUCCESS);
}
isc_int64_t t;
/* Find the right epoch. */
start -= 0x7fffffff;
base = 0;
base += 0x80000000;
base += 0x80000000;
}
return (dns_time64_totext(t, target));
}
int secs;
int i;
do { \
return (DNS_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 (DNS_R_SUCCESS);
}
if (result != DNS_R_SUCCESS)
return (result);
return DNS_R_RANGE;
return DNS_R_SUCCESS;
}