1
0
Fork 0
mirror of https://github.com/gwm17/implot.git synced 2024-11-13 22:48:50 -05:00

ImPlotTimeFmt_HrMinSMs time format

ImPlotTimeFmt_HrMinSMs,        // 7:21:29.428pm (19:21:29.428)
This commit is contained in:
ozlb 2020-09-18 00:35:14 +02:00 committed by GitHub
parent 04cc84ece0
commit 9e927df91e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -845,6 +845,7 @@ int FormatTime12(const ImPlotTime& t, char* buffer, int size, ImPlotTimeFmt fmt)
case ImPlotTimeFmt_SUs: return snprintf(buffer, size, ":%02d.%03d %03d", sec, ms, us);
case ImPlotTimeFmt_SMs: return snprintf(buffer, size, ":%02d.%03d", sec, ms);
case ImPlotTimeFmt_S: return snprintf(buffer, size, ":%02d", sec);
case ImPlotTimeFmt_HrMinSMs: return snprintf(buffer, size, "%d:%02d:%02d.%03d%s", hr, min, sec, ms, ap);
case ImPlotTimeFmt_HrMinS: return snprintf(buffer, size, "%d:%02d:%02d%s", hr, min, sec, ap);
case ImPlotTimeFmt_HrMin: return snprintf(buffer, size, "%d:%02d%s", hr, min, ap);
case ImPlotTimeFmt_Hr: return snprintf(buffer, size, "%d%s", hr, ap);
@ -881,6 +882,7 @@ int FormatTime24(const ImPlotTime& t, char* buffer, int size, ImPlotTimeFmt fmt)
case ImPlotTimeFmt_SUs: return snprintf(buffer, size, ":%02d.%03d %03d", sec, ms, us);
case ImPlotTimeFmt_SMs: return snprintf(buffer, size, ":%02d.%03d", sec, ms);
case ImPlotTimeFmt_S: return snprintf(buffer, size, ":%02d", sec);
case ImPlotTimeFmt_HrMinSMs: return snprintf(buffer, size, "%02d:%02d:%02d.%03d", hr, min, sec, ms);
case ImPlotTimeFmt_HrMinS: return snprintf(buffer, size, "%02d:%02d:%02d", hr, min, sec);
case ImPlotTimeFmt_HrMin: return snprintf(buffer, size, "%02d:%02d", hr, min);
case ImPlotTimeFmt_Hr: return snprintf(buffer, size, "%02d:00", hr);
@ -905,6 +907,7 @@ inline float GetTimeLabelWidth12(ImPlotTimeFmt fmt) {
case ImPlotTimeFmt_SUs: return ImGui::CalcTextSize(":88.888 888").x; // :29.428 552
case ImPlotTimeFmt_SMs: return ImGui::CalcTextSize(":88.888").x; // :29.428
case ImPlotTimeFmt_S: return ImGui::CalcTextSize(":88").x; // :29
case ImPlotTimeFmt_HrMinSMs: return ImGui::CalcTextSize("88:88:88.888pm").x; // 7:21:29.428pm
case ImPlotTimeFmt_HrMinS: return ImGui::CalcTextSize("88:88:88pm").x; // 7:21:29pm
case ImPlotTimeFmt_HrMin: return ImGui::CalcTextSize("88:88pm").x; // 7:21pm
case ImPlotTimeFmt_Hr: return ImGui::CalcTextSize("88pm").x; // 7pm
@ -929,6 +932,7 @@ inline float GetTimeLabelWidth24(ImPlotTimeFmt fmt) {
case ImPlotTimeFmt_SUs: return ImGui::CalcTextSize(":88.888 888").x; // :29.428 552
case ImPlotTimeFmt_SMs: return ImGui::CalcTextSize(":88.888").x; // :29.428
case ImPlotTimeFmt_S: return ImGui::CalcTextSize(":88").x; // :29
case ImPlotTimeFmt_HrMinSMs: return ImGui::CalcTextSize("88:88:88.888").x; // 19:21:29.428
case ImPlotTimeFmt_HrMinS: return ImGui::CalcTextSize("88:88:88").x; // 19:21:29
case ImPlotTimeFmt_HrMin: return ImGui::CalcTextSize("88:88").x; // 19:21
case ImPlotTimeFmt_Hr: return ImGui::CalcTextSize("88:00").x; // 19:00

View File

@ -187,6 +187,7 @@ enum ImPlotTimeFmt_ {
ImPlotTimeFmt_SUs, // :29.428 552
ImPlotTimeFmt_SMs, // :29.428
ImPlotTimeFmt_S, // :29
ImPlotTimeFmt_HrMinSMs, // 7:21:29.428pm (19:21:29.428)
ImPlotTimeFmt_HrMinS, // 7:21:29pm (19:21:29)
ImPlotTimeFmt_HrMin, // 7:21pm (19:21)
ImPlotTimeFmt_Hr, // 7pm (19:00)