41 {
42
43 double remain;
44
45 int day, hour, min, mon, sec, year;
46
47
49
50
51 if (argc < 2)
52 ERRMSG(
"Missing or invalid command-line arguments.\n\n"
53 "Usage: jsec2time <jsec>\n\n" "Use -h for full help.");
54
55
56 const double jsec = atof(argv[1]);
57
58
59 jsec2time(jsec, &year, &mon, &day, &hour, &min, &sec, &remain);
60 printf("%d %d %d %d %d %d %g\n", year, mon, day, hour, min, sec, remain);
61
62 return EXIT_SUCCESS;
63}
void jsec2time(const double jsec, int *year, int *mon, int *day, int *hour, int *min, int *sec, double *remain)
Converts Julian seconds to calendar date and time components.
#define ERRMSG(...)
Print an error message with contextual information and terminate the program.
#define USAGE
Print usage information on -h or --help.