MPTRAC
Functions
jsec2time.c File Reference

Convert Julian seconds to date. More...

#include "mptrac.h"

Go to the source code of this file.

Functions

void usage (void)
 Print command-line help. More...
 
int main (int argc, char *argv[])
 

Detailed Description

Convert Julian seconds to date.

Definition in file jsec2time.c.

Function Documentation

◆ usage()

void usage ( void  )

Print command-line help.

Definition at line 68 of file jsec2time.c.

69 {
70
71 printf("\nMPTRAC jsec2time tool.\n\n");
72 printf("Convert seconds since 2000-01-01 00:00 UTC to calendar time.\n");
73 printf("\n");
74 printf("Usage:\n");
75 printf(" jsec2time <jsec>\n");
76 printf("\n");
77 printf("Arguments:\n");
78 printf(" <jsec> Seconds since 2000-01-01 00:00 UTC.\n");
79 printf("\nFurther information:\n");
80 printf(" Manual: https://slcs-jsc.github.io/mptrac/\n");
81}

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 39 of file jsec2time.c.

41 {
42
43 double remain;
44
45 int day, hour, min, mon, sec, year;
46
47 /* Print usage information... */
48 USAGE;
49
50 /* Check arguments... */
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 /* Read arguments... */
56 const double jsec = atof(argv[1]);
57
58 /* Convert time... */
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.
Definition: mptrac.c:2294
#define ERRMSG(...)
Print an error message with contextual information and terminate the program.
Definition: mptrac.h:2102
#define USAGE
Print usage information on -h or --help.
Definition: mptrac.h:1909
Here is the call graph for this function: