Blame tests/datefudge-check.c

Packit Service 4684c1
/*
Packit Service 4684c1
 * Copyright (C) 2019 Red Hat
Packit Service 4684c1
 *
Packit Service 4684c1
 * Author: Daiki Ueno
Packit Service 4684c1
 *
Packit Service 4684c1
 * This file is part of GnuTLS.
Packit Service 4684c1
 *
Packit Service 4684c1
 * GnuTLS is free software; you can redistribute it and/or modify it
Packit Service 4684c1
 * under the terms of the GNU General Public License as published by
Packit Service 4684c1
 * the Free Software Foundation; either version 3 of the License, or
Packit Service 4684c1
 * (at your option) any later version.
Packit Service 4684c1
 *
Packit Service 4684c1
 * GnuTLS is distributed in the hope that it will be useful, but
Packit Service 4684c1
 * WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 4684c1
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 4684c1
 * General Public License for more details.
Packit Service 4684c1
 *
Packit Service 4684c1
 * You should have received a copy of the GNU Lesser General Public License
Packit Service 4684c1
 * along with this program.  If not, see <https://www.gnu.org/licenses/>
Packit Service 4684c1
 */
Packit Service 4684c1
Packit Service 4684c1
#ifdef HAVE_CONFIG_H
Packit Service 4684c1
#include "config.h"
Packit Service 4684c1
#endif
Packit Service 4684c1
Packit Service 4684c1
#include <stdio.h>
Packit Service 4684c1
#include <stdlib.h>
Packit Service 4684c1
#include <time.h>
Packit Service 4684c1
Packit Service 4684c1
int
Packit Service 4684c1
main (void)
Packit Service 4684c1
{
Packit Service 4684c1
	char outstr[200];
Packit Service 4684c1
	time_t t;
Packit Service 4684c1
	struct tm *tmp;
Packit Service 4684c1
Packit Service 4684c1
	t = time(NULL);
Packit Service 4684c1
	tmp = localtime(&t);
Packit Service 4684c1
	if (tmp == NULL) {
Packit Service 4684c1
		perror("localtime");
Packit Service 4684c1
		exit(EXIT_FAILURE);
Packit Service 4684c1
	}
Packit Service 4684c1
Packit Service 4684c1
	if (strftime(outstr, sizeof(outstr), "%s", tmp) == 0) {
Packit Service 4684c1
		fprintf(stderr, "strftime returned 0");
Packit Service 4684c1
		exit(EXIT_FAILURE);
Packit Service 4684c1
	}
Packit Service 4684c1
Packit Service 4684c1
	puts(outstr);
Packit Service 4684c1
	exit(EXIT_SUCCESS);
Packit Service 4684c1
}