@@ -28,12 +28,8 @@ std::string TimeUtils::timeToString(time_t input) {
28
28
29
29
std::string TimeUtils::isoTimeToString (const std::string& input) {
30
30
if (input.empty ()) return " NA" ;
31
- std::string output;
32
- getline (std::istringstream (input), output, ' T' );
33
- return output;
34
- /* int y,M,d;
35
- sscanf(input.c_str(), "%d-%d-%dT", &y, &M, &d);
36
- return fmt::format("{}-{:02}-{:02}", y, M, d);*/
31
+ auto pos = input.find (' T' );
32
+ return pos != std::string::npos ? input.substr (0 , pos) : input;
37
33
}
38
34
39
35
std::string TimeUtils::workingTime (int value){
@@ -44,12 +40,12 @@ std::string TimeUtils::workingTime(int value){
44
40
int minutes = (value % 3600 ) / 60 ;
45
41
int seconds = value % 60 ;
46
42
47
- std::ostringstream stream ;
48
- if (hours > 0 ) stream << hours << " h " ;
49
- if (hours > 0 || minutes > 0 ) stream << minutes << " m " ;
50
- stream << seconds << " s " ;
43
+ std::string res ;
44
+ if (hours > 0 ) res += fmt::format ( " {} h " , hours) ;
45
+ if (hours > 0 || minutes > 0 ) res += fmt::format ( " {} m " , minutes) ;
46
+ res += fmt::format ( " {}s " , seconds) ;
51
47
52
- return stream. str () ;
48
+ return res ;
53
49
}
54
50
55
51
std::string TimeUtils::platformerTime (int value, bool showMilliseconds){
0 commit comments