CppEphem
jd2mjd.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * jd2mjd.cpp: CppEphem *
3  * ----------------------------------------------------------------------- *
4  * Copyright © 2016 JCardenzana *
5  * ----------------------------------------------------------------------- *
6  * *
7  * This program is free software: you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation, either version 3 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This program is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU General Public License *
18  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
19  * *
20  ***************************************************************************/
21 
22 #include <stdio.h>
23 #include "CppEphem.h"
24 
25 /**********************************************************************/
27 int main(int argc, const char * argv[]) {
28  // Check that we've been passed an actual argument
29  if (argc < 2) {
30  // Print some usage information
31  std::cout << "jd2mjd v" << CPPEPHEM_VERSION << "\n";
32  std::cout << "\nUSAGE: jd2mjd <julian date>\n" ;
33  std::cout << "RETURNED: Modified Julian Date\n\n" ;
34  return 0 ;
35  }
36 
37  // Convert the input variable to a double
38  double jd = std::stod(std::string(argv[1])) ;
39 
40  // Print the resulting MJD value
41  std::printf("%f\n", CEDate::JD2MJD(jd)) ;
42 
43  return 0 ;
44 }
main
int main(int argc, const char *argv[])
Definition: jd2mjd.cpp:26
CppEphem.h
CEDate::JD2MJD
static double JD2MJD(double jd)
Julian date -> modified Julian date conversion method.
Definition: CEDate.cpp:182