| 1 | /* |
| 2 | * SPDX-License-Identifier: CC0-1.0 |
| 3 | * |
| 4 | * clock.hxx. |
| 5 | * Written by Melchior FRANZ, started 2003. |
| 6 | * |
| 7 | * This file is in the Public Domain and comes with no warranty. |
| 8 | * |
| 9 | * $Id$ |
| 10 | */ |
| 11 | |
| 12 | #pragma once |
| 13 | |
| 14 | #include <simgear/props/props.hxx> |
| 15 | #include <simgear/structure/subsystem_mgr.hxx> |
| 16 | |
| 17 | |
| 18 | /** |
| 19 | * Model a clock. |
| 20 | * |
| 21 | * Input properties: |
| 22 | * |
| 23 | * /instrumentation/clock/serviceable |
| 24 | * /instrumentation/clock/offset-sec |
| 25 | * |
| 26 | * Output properties: |
| 27 | * |
| 28 | * /instrumentation/clock/indicated-sec |
| 29 | * /instrumentation/clock/indicated-string |
| 30 | */ |
| 31 | class Clock : public SGSubsystem |
| 32 | { |
| 33 | public: |
| 34 | Clock(SGPropertyNode *node); |
| 35 | virtual ~Clock(); |
| 36 | |
| 37 | // Subsystem API. |
| 38 | void init() override; |
| 39 | void update(double dt) override; |
| 40 | |
| 41 | // Subsystem identification. |
| 42 | static const char* staticSubsystemClassId() { return "clock"; } |
| 43 | |
| 44 | private: |
| 45 | std::string _name; |
| 46 | unsigned int _num; |
| 47 | |
| 48 | bool _is_serviceable; |
| 49 | long _gmt_time_sec; |
| 50 | long _offset_sec; |
| 51 | long _indicated_sec; |
| 52 | long _indicated_min; |
| 53 | long _indicated_hour; |
| 54 | long _local_hour; |
| 55 | char _indicated_string[16]; |
| 56 | char _indicated_short_string[16]; |
| 57 | char _local_short_string[16]; |
| 58 | long _standstill_offset; |
| 59 | |
| 60 | SGPropertyNode_ptr _serviceable_node; |
| 61 | SGPropertyNode_ptr _offset_node; |
| 62 | SGPropertyNode_ptr _sec_node; |
| 63 | SGPropertyNode_ptr _hour_node; |
| 64 | SGPropertyNode_ptr _lhour_node; |
| 65 | SGPropertyNode_ptr _min_node; |
| 66 | SGPropertyNode_ptr _string_node; |
| 67 | SGPropertyNode_ptr _string_node1; |
| 68 | SGPropertyNode_ptr _string_node2; |
| 69 | }; |