| 1 | /* |
| 2 | SPDX-Copyright: Keith Paterson 2025 |
| 3 | SPDX-License-Identifier: GPL-2.0-or-later |
| 4 | */ |
| 5 | |
| 6 | #include "testStringUtils.hxx" |
| 7 | |
| 8 | #include <Main/globals.hxx> |
| 9 | |
| 10 | #include <simgear/timing/sg_time.hxx> |
| 11 | |
| 12 | using namespace flightgear; |
| 13 | |
| 14 | namespace FGTestApi { |
| 15 | |
| 16 | namespace strings { |
| 17 | std::string getTimeString(int timeOffset) |
| 18 | { |
| 19 | char ret[11]; |
| 20 | time_t rawtime = globals->get_time_params()->get_cur_time(); |
| 21 | rawtime = rawtime + timeOffset; |
| 22 | tm* timeinfo = gmtime(&rawtime); |
| 23 | strftime(ret, 11, "%w/%H:%M:%S", timeinfo); |
| 24 | return ret; |
| 25 | } |
| 26 | |
| 27 | } // End of namespace strings. |
| 28 | |
| 29 | } // End of namespace FGTestApi. |