Syd Adams:
I made some changes to clock.cxx to output minute, hour and a shortened text string (hh:mm) for the digital clock in the Citation Bravo...
This commit is contained in:
parent
5430d87f01
commit
397a15c829
2 changed files with 19 additions and 0 deletions
|
@ -17,6 +17,8 @@ Clock::Clock ( SGPropertyNode *node )
|
|||
_gmt_time_sec(0),
|
||||
_offset_sec(0),
|
||||
_indicated_sec(0),
|
||||
_indicated_min(0),
|
||||
_indicated_hour(0),
|
||||
_standstill_offset(0),
|
||||
name("clock"),
|
||||
num(0)
|
||||
|
@ -49,6 +51,7 @@ Clock::Clock ()
|
|||
_standstill_offset(0)
|
||||
{
|
||||
_indicated_string[0] = '\0';
|
||||
_indicated_short_string[0] = '\0';
|
||||
}
|
||||
|
||||
Clock::~Clock ()
|
||||
|
@ -65,7 +68,10 @@ Clock::init ()
|
|||
_serviceable_node = node->getChild("serviceable", 0, true);
|
||||
_offset_node = node->getChild("offset-sec", 0, true);
|
||||
_sec_node = node->getChild("indicated-sec", 0, true);
|
||||
_min_node = node->getChild("indicated-min", 0, true);
|
||||
_hour_node = node->getChild("indicated-hour", 0, true);
|
||||
_string_node = node->getChild("indicated-string", 0, true);
|
||||
_string_node1 = node->getChild("indicated-short-string", 0, true);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -122,7 +128,14 @@ Clock::update (double delta_time_sec)
|
|||
|
||||
sprintf(_indicated_string, "%02d:%02d:%02d", hour, min, sec);
|
||||
_string_node->setStringValue(_indicated_string);
|
||||
sprintf(_indicated_short_string, "%02d:%02d", hour, min);
|
||||
_string_node1->setStringValue(_indicated_short_string);
|
||||
_is_serviceable = true;
|
||||
|
||||
_indicated_min = min;
|
||||
_min_node->setLongValue(_indicated_min);
|
||||
_indicated_hour = hour;
|
||||
_hour_node->setLongValue(_indicated_hour);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -48,7 +48,10 @@ private:
|
|||
long _gmt_time_sec;
|
||||
long _offset_sec;
|
||||
long _indicated_sec;
|
||||
long _indicated_min;
|
||||
long _indicated_hour;
|
||||
char _indicated_string[16];
|
||||
char _indicated_short_string[16];
|
||||
long _standstill_offset;
|
||||
|
||||
string name;
|
||||
|
@ -57,7 +60,10 @@ private:
|
|||
SGPropertyNode_ptr _serviceable_node;
|
||||
SGPropertyNode_ptr _offset_node;
|
||||
SGPropertyNode_ptr _sec_node;
|
||||
SGPropertyNode_ptr _hour_node;
|
||||
SGPropertyNode_ptr _min_node;
|
||||
SGPropertyNode_ptr _string_node;
|
||||
SGPropertyNode_ptr _string_node1;
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue