mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
Merge pull request #25 from carmel4a/minor_changes
Add conversion from `scenario_time` to `std::string`.
This commit is contained in:
@@ -194,4 +194,10 @@ scenario_time::julian_day() const {
|
||||
return JD;
|
||||
}
|
||||
|
||||
scenario_time::operator std::string(){
|
||||
|
||||
return to_string( m_time.wHour ) + ":"
|
||||
+ ( m_time.wMinute < 10 ? "0" : "" ) + to_string( m_time.wMinute ) + ":"
|
||||
+ ( m_time.wSecond < 10 ? "0" : "" ) + to_string( m_time.wSecond );
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -9,6 +9,8 @@ http://mozilla.org/MPL/2.0/.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "winheaders.h"
|
||||
|
||||
// wrapper for scenario time
|
||||
@@ -47,6 +49,8 @@ public:
|
||||
zone_bias() const {
|
||||
return m_timezonebias; }
|
||||
|
||||
/** Returns std::string in format: `"mm:ss"`. */
|
||||
operator std::string();
|
||||
private:
|
||||
// calculates day and month from given day of year
|
||||
void
|
||||
|
||||
@@ -279,12 +279,8 @@ ui_layer::update() {
|
||||
|
||||
case( GLFW_KEY_F1 ) : {
|
||||
// f1, default mode: current time and timetable excerpt
|
||||
auto const &time = simulation::Time.data();
|
||||
uitextline1 =
|
||||
"Time: "
|
||||
+ to_string( time.wHour ) + ":"
|
||||
+ ( time.wMinute < 10 ? "0" : "" ) + to_string( time.wMinute ) + ":"
|
||||
+ ( time.wSecond < 10 ? "0" : "" ) + to_string( time.wSecond );
|
||||
"Time: " + std::string( simulation::Time );
|
||||
if( Global.iPause ) {
|
||||
uitextline1 += " (paused)";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user