#define _GNU_SOURCE

#include <stdio.h>
#include <stdlib.h>
#include <err.h>
#include <time.h>
#include <errno.h>
#include "../lpi.h"

int
main(int argc, char *argv[])
{
    long t;

    if (argc < 2)
        errx(EXIT_FAILURE,
                "usage: %s time", program_invocation_name);

    for (int i = 1; i < argc; i++) {
        if (toLong(argv[i], &t) != 0) {
            warn("toLong");
            continue;
        }

        // printf("%10s %10ld %s", argv[i], t, ctime((time_t *) &t));
        printf("%s", ctime((time_t *) &t));
        break;      // we can omit this line
    }

    exit(EXIT_SUCCESS);
}
