MCPcopy Create free account
hub / github.com/SatDump/SatDump / FormatDate

Function FormatDate

src-core/imgui/implot/implot.cpp:1115–1142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1113}
1114
1115int FormatDate(const ImPlotTime& t, char* buffer, int size, ImPlotDateFmt fmt, bool use_iso_8601) {
1116 tm& Tm = GImPlot->Tm;
1117 GetTime(t, &Tm);
1118 const int day = Tm.tm_mday;
1119 const int mon = Tm.tm_mon + 1;
1120 const int year = Tm.tm_year + 1900;
1121 const int yr = year % 100;
1122 if (use_iso_8601) {
1123 switch (fmt) {
1124 case ImPlotDateFmt_DayMo: return ImFormatString(buffer, size, "--%02d-%02d", mon, day);
1125 case ImPlotDateFmt_DayMoYr: return ImFormatString(buffer, size, "%d-%02d-%02d", year, mon, day);
1126 case ImPlotDateFmt_MoYr: return ImFormatString(buffer, size, "%d-%02d", year, mon);
1127 case ImPlotDateFmt_Mo: return ImFormatString(buffer, size, "--%02d", mon);
1128 case ImPlotDateFmt_Yr: return ImFormatString(buffer, size, "%d", year);
1129 default: return 0;
1130 }
1131 }
1132 else {
1133 switch (fmt) {
1134 case ImPlotDateFmt_DayMo: return ImFormatString(buffer, size, "%d/%d", mon, day);
1135 case ImPlotDateFmt_DayMoYr: return ImFormatString(buffer, size, "%d/%d/%02d", mon, day, yr);
1136 case ImPlotDateFmt_MoYr: return ImFormatString(buffer, size, "%s %d", MONTH_ABRVS[Tm.tm_mon], year);
1137 case ImPlotDateFmt_Mo: return ImFormatString(buffer, size, "%s", MONTH_ABRVS[Tm.tm_mon]);
1138 case ImPlotDateFmt_Yr: return ImFormatString(buffer, size, "%d", year);
1139 default: return 0;
1140 }
1141 }
1142 }
1143
1144int FormatDateTime(const ImPlotTime& t, char* buffer, int size, ImPlotDateTimeSpec fmt) {
1145 int written = 0;

Callers 2

PlotCandlestickFunction · 0.85
FormatDateTimeFunction · 0.85

Calls 2

GetTimeFunction · 0.85
ImFormatStringFunction · 0.85

Tested by

no test coverage detected