1 /* $NetBSD: time_test.c,v 1.1.1.4 2015/07/08 15:38:05 christos Exp $ */
4 * Copyright (C) 2014, 2015 Internet Systems Consortium, Inc. ("ISC")
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
11 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
13 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
15 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
25 #include <isc/result.h>
27 ATF_TC(isc_time_parsehttptimestamp
);
28 ATF_TC_HEAD(isc_time_parsehttptimestamp
, tc
) {
29 atf_tc_set_md_var(tc
, "descr", "parse http time stamp");
31 ATF_TC_BODY(isc_time_parsehttptimestamp
, tc
) {
34 char buf
[ISC_FORMATHTTPTIMESTAMP_SIZE
];
36 setenv("TZ", "PST8PDT", 1);
37 result
= isc_time_now(&t
);
38 ATF_REQUIRE_EQ(result
, ISC_R_SUCCESS
);
40 isc_time_formathttptimestamp(&t
, buf
, sizeof(buf
));
41 result
= isc_time_parsehttptimestamp(buf
, &x
);
42 ATF_REQUIRE_EQ(result
, ISC_R_SUCCESS
);
43 ATF_REQUIRE_EQ(isc_time_seconds(&t
), isc_time_seconds(&x
));
50 ATF_TP_ADD_TC(tp
, isc_time_parsehttptimestamp
);
51 return (atf_no_error());