MPTRAC
jsec2time.c
Go to the documentation of this file.
1/*
2 This file is part of MPTRAC.
3
4 MPTRAC is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 MPTRAC is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with MPTRAC. If not, see <http://www.gnu.org/licenses/>.
16
17 Copyright (C) 2013-2024 Forschungszentrum Juelich GmbH
18*/
19
25#include "mptrac.h"
26
27int main(
28 int argc,
29 char *argv[]) {
30
31 double remain;
32
33 int day, hour, min, mon, sec, year;
34
35 /* Check arguments... */
36 if (argc < 2)
37 ERRMSG("Give parameters: <jsec>");
38
39 /* Read arguments... */
40 double jsec = atof(argv[1]);
41
42 /* Convert time... */
43 jsec2time(jsec, &year, &mon, &day, &hour, &min, &sec, &remain);
44 printf("%d %d %d %d %d %d %g\n", year, mon, day, hour, min, sec, remain);
45
46 return EXIT_SUCCESS;
47}
int main(int argc, char *argv[])
Definition: jsec2time.c:27
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.
Definition: mptrac.c:1771
MPTRAC library declarations.
#define ERRMSG(...)
Print an error message with contextual information and terminate the program.
Definition: mptrac.h:1881