38 bool iTime::p_lpInitialized =
false;
55 iTime::iTime(
const QString &time) {
56 LoadLeapSecondKernel();
58 NaifStatus::CheckErrors();
62 str2et_c(time.toLatin1().data(), &et);
65 NaifStatus::CheckErrors();
79 void iTime::operator=(
const QString &time) {
80 LoadLeapSecondKernel();
82 NaifStatus::CheckErrors();
85 str2et_c(time.toLatin1().data(), &et);
88 NaifStatus::CheckErrors();
92 void iTime::operator=(
const char *time) {
93 LoadLeapSecondKernel();
95 NaifStatus::CheckErrors();
101 NaifStatus::CheckErrors();
106 void iTime::operator=(
const double time) {
107 LoadLeapSecondKernel();
118 bool iTime::operator>=(
const iTime &time) {
119 return (p_et >= time.
p_et);
129 bool iTime::operator<=(
const iTime &time) {
130 return (p_et <= time.
p_et);
140 bool iTime::operator>(
const iTime &time) {
141 return (p_et > time.
p_et);
152 bool iTime::operator<(
const iTime &time) {
153 return (p_et < time.
p_et);
163 bool iTime::operator!=(
const iTime &time) {
164 return (p_et != time.
p_et);
174 bool iTime::operator==(
const iTime &time) {
175 return (p_et == time.
p_et);
179 iTime iTime::operator +(
const double &secondsToAdd)
const {
186 void iTime::operator +=(
const double &secondsToAdd) {
188 p_et += secondsToAdd;
192 iTime operator +(
const double &secondsToAdd, iTime time) {
193 time += secondsToAdd;
200 iTime iTime::operator -(
const double &secondsToSubtract)
const {
202 tmp -= secondsToSubtract;
207 double iTime::operator -(
const iTime &iTimeToSubtract)
const {
208 return p_et - iTimeToSubtract.p_et;
212 void iTime::operator -=(
const double &secondsToSubtract) {
214 p_et -= secondsToSubtract;
218 iTime operator -(
const double &secondsToSubtract, iTime time) {
219 time -= secondsToSubtract;
233 QString iTime::YearString()
const {
242 int iTime::Year()
const {
243 NaifStatus::CheckErrors();
247 timout_c(p_et,
"YYYY", 5, out);
248 NaifStatus::CheckErrors();
257 QString iTime::MonthString()
const {
266 int iTime::Month()
const {
267 NaifStatus::CheckErrors();
271 timout_c(p_et,
"MM", 3, out);
272 NaifStatus::CheckErrors();
281 QString iTime::DayString()
const {
290 int iTime::Day()
const {
291 NaifStatus::CheckErrors();
295 timout_c(p_et,
"DD", 3, out);
296 NaifStatus::CheckErrors();
305 QString iTime::HourString()
const {
314 int iTime::Hour()
const {
315 NaifStatus::CheckErrors();
319 timout_c(p_et,
"HR", 3, out);
320 NaifStatus::CheckErrors();
329 QString iTime::MinuteString()
const {
338 int iTime::Minute()
const {
339 NaifStatus::CheckErrors();
343 timout_c(p_et,
"MN", 3, out);
344 NaifStatus::CheckErrors();
353 QString iTime::SecondString(
int precision)
const {
355 osec.setf(ios::fixed);
356 osec << setprecision(precision) << Second();
357 QString sSeconds(osec.str().c_str());
358 sSeconds = sSeconds.remove(QRegExp(
"(\\.0*|0*)$"));
360 if(sSeconds.isEmpty()) sSeconds =
"0";
369 double iTime::Second()
const {
370 NaifStatus::CheckErrors();
374 timout_c(p_et,
"SC.#######::RND", 256, out);
375 NaifStatus::CheckErrors();
384 QString iTime::DayOfYearString()
const {
393 int iTime::DayOfYear()
const {
394 NaifStatus::CheckErrors();
398 timout_c(p_et,
"DOY", 4, out);
399 NaifStatus::CheckErrors();
409 QString iTime::EtString()
const {
418 QString iTime::UTC(
int precision)
const {
419 QString utc = YearString() +
"-" ;
420 if(Month() < 10) utc +=
"0" + MonthString() +
"-";
421 else utc += MonthString() +
"-";
423 if(Day() < 10) utc +=
"0" + DayString() +
"T";
424 else utc += DayString() +
"T";
426 if(Hour() < 10) utc +=
"0" + HourString() +
":";
427 else utc += HourString() +
":";
429 if(Minute() < 10) utc +=
"0" + MinuteString() +
":";
430 else utc += MinuteString() +
":";
432 if(Second() < 10) utc +=
"0" + SecondString(precision);
433 else utc += SecondString(precision);
438 void iTime::setEt(
double et) {
445 void iTime::setUtc(QString utcString) {
446 NaifStatus::CheckErrors();
447 LoadLeapSecondKernel();
450 utc2et_c(utcString.toLatin1().data(), &et);
452 NaifStatus::CheckErrors();
461 void iTime::LoadLeapSecondKernel() {
464 if(p_lpInitialized)
return;
468 QString baseDir = dataDir[
"Base"];
469 baseDir +=
"/kernels/lsk/";
470 FileName leapSecond(baseDir +
"naif????.tls");
472 NaifStatus::CheckErrors();
474 furnsh_c(leapSecondName.toLatin1().data());
475 NaifStatus::CheckErrors();
477 p_lpInitialized =
true;
487 QString iTime::CurrentGMT() {
488 time_t startTime = time(NULL);
489 struct tm *tmbuf = gmtime(&startTime);
491 strftime(timestr, 80,
"%Y-%m-%dT%H:%M:%S", tmbuf);
492 return (QString) timestr;
503 QString iTime::CurrentLocalTime() {
504 time_t startTime = time(NULL);
505 struct tm *tmbuf = localtime(&startTime);
507 strftime(timestr, 80,
"%Y-%m-%dT%H:%M:%S", tmbuf);
508 return (QString) timestr;
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
File name manipulation and expansion.
Parse and return pieces of a time string.
double ToDouble() const
Returns the floating point value the IString represents.
Namespace for the standard library.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
int ToInteger() const
Returns the object string as an integer.
Contains multiple PvlContainers.
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
bool IsSpecial(const double d)
Returns if the input pixel is special.
double p_et
The ephemeris representaion of the original string passed into the constructor or the operator= membe...
FileName highestVersion() const
Searches the directory specified in the file name for the highest version of the file name...
Adds specific functionality to C++ strings.
Namespace for ISIS/Bullet specific routines.