mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-19 18:49:52 -06:00
- Moved all OpenSpace headers to separate include directory - Added OpenSpaceTests binary with OPENSPACE_HAVE_TESTS define - Added CMake setting of BASE_DIR - Added OpenSpace initial tests for SceneGraph and SceneGraphNodes - Added OpenSpace initial tests for psc and pss - Restructured OpenSpace so no GL functions are called in constructors to make the classes testable - Todo: Make the base dir possible to set through command line argument and configuration file
63 lines
967 B
C++
63 lines
967 B
C++
|
|
// open space includes
|
|
#include <openspace/util/time.h>
|
|
#include <openspace/interaction/interactionhandler.h>
|
|
|
|
// std includes
|
|
#include <cassert>
|
|
|
|
// spice includes
|
|
#include "SpiceUsr.h"
|
|
#include <ghoul/filesystem/filesystem.h>
|
|
|
|
namespace openspace {
|
|
|
|
Time* Time::this_ = nullptr;
|
|
|
|
Time::Time() {
|
|
time_ = 0.0;
|
|
|
|
// load spice time kernel
|
|
furnsh_c (absPath("${OPENSPACE-DATA}/spice/naif0010.tls").c_str());
|
|
|
|
// convert UTC to ET
|
|
str2et_c ( "2006 JAN 31 01:00", &time_ );
|
|
}
|
|
|
|
Time::~Time() {
|
|
|
|
}
|
|
|
|
void Time::init() {
|
|
assert( this_ == nullptr);
|
|
this_ = new Time();
|
|
}
|
|
|
|
void Time::deinit() {
|
|
assert(this_);
|
|
delete this_;
|
|
this_ = nullptr;
|
|
}
|
|
|
|
Time& Time::ref() {
|
|
assert(this_);
|
|
return *this_;
|
|
}
|
|
|
|
bool Time::isInitialized() {
|
|
return this_ != nullptr;
|
|
}
|
|
|
|
void Time::setTime(const char* stringTime) {
|
|
assert(this_);
|
|
// convert UTC to ET
|
|
str2et_c ( stringTime, &time_ );
|
|
}
|
|
|
|
double Time::getTime() {
|
|
assert(this_);
|
|
return time_;
|
|
}
|
|
|
|
} // namespace openspace
|