Added missing string header; fixed scanf in parseDate

ver1_5_1
Chris Laurel 2002-11-04 17:51:56 +00:00
parent 584e533cc3
commit d6c5756b92
2 changed files with 13 additions and 1 deletions

View File

@ -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)

View File

@ -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);