diff options
| author | Konstantin <const@const.me> | 2023-02-03 19:01:04 +0100 |
|---|---|---|
| committer | Konstantin <const@const.me> | 2023-02-03 19:01:04 +0100 |
| commit | 3f3a9a156736d4da0339b3c2d9b042f4ed7c7fb2 (patch) | |
| tree | c3a4ba4291cb9fd6fae27d1e86c5ec26578aa6a2 /Examples/WhisperDesktop/Utils/logger.cpp | |
| parent | 3ba8e6389679007445f4fc1c52439cb0df3ddba0 (diff) | |
Refactor, removed a redundant function
Diffstat (limited to 'Examples/WhisperDesktop/Utils/logger.cpp')
| -rw-r--r-- | Examples/WhisperDesktop/Utils/logger.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/Examples/WhisperDesktop/Utils/logger.cpp b/Examples/WhisperDesktop/Utils/logger.cpp index 5c7c257..712835b 100644 --- a/Examples/WhisperDesktop/Utils/logger.cpp +++ b/Examples/WhisperDesktop/Utils/logger.cpp @@ -24,14 +24,17 @@ namespace } } -void printTimeStamp( CStringA& rdi, Whisper::sTimeSpan ts ) +void printTime( CStringA& rdi, Whisper::sTimeSpan time, bool comma ) { - sTimeSpanFields fields = ts; - uint32_t msec = fields.ticks / 10'000; - uint32_t hr = fields.days * 24 + fields.hours; - uint32_t min = fields.minutes; - uint32_t sec = fields.seconds; - rdi.AppendFormat( "%02d:%02d:%02d.%03d", hr, min, sec, msec ); + Whisper::sTimeSpanFields fields = time; + const uint32_t hours = fields.days * 24 + fields.hours; + const char separator = comma ? ',' : '.'; + rdi.AppendFormat( "%02d:%02d:%02d%c%03d", + (int)hours, + (int)fields.minutes, + (int)fields.seconds, + separator, + fields.ticks / 10'000 ); } HRESULT logNewSegments( const iTranscribeResult* results, size_t newSegments, bool printSpecial ) @@ -50,9 +53,9 @@ HRESULT logNewSegments( const iTranscribeResult* results, size_t newSegments, bo { const sSegment& seg = segments[ i ]; str = "["; - printTimeStamp( str, seg.time.begin ); + printTime( str, seg.time.begin ); str += " --> "; - printTimeStamp( str, seg.time.end ); + printTime( str, seg.time.end ); str += "] "; for( uint32_t j = 0; j < seg.countTokens; j++ ) |
