| 922 | } |
| 923 | |
| 924 | inline int GetTimeStep(int max_divs, ImPlotTimeUnit unit) { |
| 925 | if (unit == ImPlotTimeUnit_Ms || unit == ImPlotTimeUnit_Us) { |
| 926 | constexpr int step[] = {500,250,200,100,50,25,20,10,5,2,1}; |
| 927 | constexpr int divs[] = {2,4,5,10,20,40,50,100,200,500,1000}; |
| 928 | return LowerBoundStep(max_divs, divs, step, 11); |
| 929 | } |
| 930 | if (unit == ImPlotTimeUnit_S || unit == ImPlotTimeUnit_Min) { |
| 931 | constexpr int step[] = {30,15,10,5,1}; |
| 932 | constexpr int divs[] = {2,4,6,12,60}; |
| 933 | return LowerBoundStep(max_divs, divs, step, 5); |
| 934 | } |
| 935 | else if (unit == ImPlotTimeUnit_Hr) { |
| 936 | constexpr int step[] = {12,6,3,2,1}; |
| 937 | constexpr int divs[] = {2,4,8,12,24}; |
| 938 | return LowerBoundStep(max_divs, divs, step, 5); |
| 939 | } |
| 940 | else if (unit == ImPlotTimeUnit_Day) { |
| 941 | constexpr int step[] = {14,7,2,1}; |
| 942 | constexpr int divs[] = {2,4,14,28}; |
| 943 | return LowerBoundStep(max_divs, divs, step, 4); |
| 944 | } |
| 945 | else if (unit == ImPlotTimeUnit_Mo) { |
| 946 | constexpr int step[] = {6,3,2,1}; |
| 947 | constexpr int divs[] = {2,4,6,12}; |
| 948 | return LowerBoundStep(max_divs, divs, step, 4); |
| 949 | } |
| 950 | return 0; |
| 951 | } |
| 952 | |
| 953 | ImPlotTime MkGmtTime(struct tm *ptm) { |
| 954 | ImPlotTime t; |
no test coverage detected