Added missing string header; fixed scanf in parseDate
parent
584e533cc3
commit
d6c5756b92
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include <cmath>
|
||||
#include <iomanip>
|
||||
#include <cstdio>
|
||||
#include <celmath/mathlib.h>
|
||||
#include "celestia.h"
|
||||
#include "astro.h"
|
||||
|
@ -295,6 +296,15 @@ double astro::meanEclipticObliquity(double jd)
|
|||
return 23.439292 - de;
|
||||
}
|
||||
|
||||
astro::Date::Date()
|
||||
{
|
||||
year = 0;
|
||||
month = 0;
|
||||
day = 0;
|
||||
hour = 0;
|
||||
minute = 0;
|
||||
seconds = 0.0;
|
||||
}
|
||||
|
||||
astro::Date::Date(int Y, int M, int D)
|
||||
{
|
||||
|
@ -379,7 +389,7 @@ bool astro::parseDate(const string& s, astro::Date& date)
|
|||
if (sscanf(s.c_str(), " %d %u %u %u:%u:%u ",
|
||||
&year, &month, &day, &hour, &minute, &second) == 6 ||
|
||||
sscanf(s.c_str(), " %d %u %u %u:%u ",
|
||||
&year, &month, &day, &hour, &minute, &second) == 5 ||
|
||||
&year, &month, &day, &hour, &minute) == 5 ||
|
||||
sscanf(s.c_str(), " %d %u %u ", &year, &month, &day) == 3)
|
||||
{
|
||||
if (month < 1 || month > 12)
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#define _ASTRO_H_
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <celmath/vecmath.h>
|
||||
#include <celengine/univcoord.h>
|
||||
|
||||
|
@ -26,6 +27,7 @@ namespace astro
|
|||
class Date
|
||||
{
|
||||
public:
|
||||
Date();
|
||||
Date(int Y, int M, int D);
|
||||
Date(double);
|
||||
|
||||
|
|
Loading…
Reference in New Issue