MPTRAC
Functions
time2jsec.c File Reference

Convert date to Julian seconds. 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 date to Julian seconds.

Definition in file time2jsec.c.

Function Documentation

◆ usage()

void usage ( void  )

Print command-line help.

Definition at line 73 of file time2jsec.c.

74 {
75
76 printf("\nMPTRAC time2jsec tool.\n\n");
77 printf("Convert calendar time to seconds since 2000-01-01 00:00 UTC.\n");
78 printf("\n");
79 printf("Usage:\n");
80 printf(" time2jsec <year> <mon> <day> <hour> <min> <sec> <remain>\n");
81 printf("\n");
82 printf("Arguments:\n");
83 printf(" <year> Year.\n");
84 printf(" <mon> Month.\n");
85 printf(" <day> Day of month.\n");
86 printf(" <hour> Hour.\n");
87 printf(" <min> Minute.\n");
88 printf(" <sec> Second.\n");
89 printf(" <remain> Fractional-second remainder.\n");
90 printf("\nFurther information:\n");
91 printf(" Manual: https://slcs-jsc.github.io/mptrac/\n");
92}

◆ main()

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

Definition at line 39 of file time2jsec.c.

41 {
42
43 double jsec;
44
45 /* Print usage information... */
46 USAGE;
47
48 /* Check arguments... */
49 if (argc < 8)
50 ERRMSG("Missing or invalid command-line arguments.\n\n"
51 "Usage: time2jsec <year> <mon> <day> <hour> <min> <sec> <remain>\n\n"
52 "Use -h for full help.");
53
54 /* Read arguments... */
55 const int year = atoi(argv[1]);
56 const int mon = atoi(argv[2]);
57 const int day = atoi(argv[3]);
58 const int hour = atoi(argv[4]);
59 const int min = atoi(argv[5]);
60 const int sec = atoi(argv[6]);
61 const double remain = atof(argv[7]);
62
63 /* Convert... */
64 time2jsec(year, mon, day, hour, min, sec, remain, &jsec);
65 printf("%.2f\n", jsec);
66
67 return EXIT_SUCCESS;
68}
void time2jsec(const int year, const int mon, const int day, const int hour, const int min, const int sec, const double remain, double *jsec)
Converts time components to seconds since January 1, 2000, 12:00:00 UTC.
Definition: mptrac.c:10918
#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: