| 876 | } |
| 877 | |
| 878 | inline int GetTimeStep(int max_divs, ImPlotTimeUnit unit) { |
| 879 | if (unit == ImPlotTimeUnit_Ms || unit == ImPlotTimeUnit_Us) { |
| 880 | static const int step[] = {500,250,200,100,50,25,20,10,5,2,1}; |
| 881 | static const int divs[] = {2,4,5,10,20,40,50,100,200,500,1000}; |
| 882 | return LowerBoundStep(max_divs, divs, step, 11); |
| 883 | } |
| 884 | if (unit == ImPlotTimeUnit_S || unit == ImPlotTimeUnit_Min) { |
| 885 | static const int step[] = {30,15,10,5,1}; |
| 886 | static const int divs[] = {2,4,6,12,60}; |
| 887 | return LowerBoundStep(max_divs, divs, step, 5); |
| 888 | } |
| 889 | else if (unit == ImPlotTimeUnit_Hr) { |
| 890 | static const int step[] = {12,6,3,2,1}; |
| 891 | static const int divs[] = {2,4,8,12,24}; |
| 892 | return LowerBoundStep(max_divs, divs, step, 5); |
| 893 | } |
| 894 | else if (unit == ImPlotTimeUnit_Day) { |
| 895 | static const int step[] = {14,7,2,1}; |
| 896 | static const int divs[] = {2,4,14,28}; |
| 897 | return LowerBoundStep(max_divs, divs, step, 4); |
| 898 | } |
| 899 | else if (unit == ImPlotTimeUnit_Mo) { |
| 900 | static const int step[] = {6,3,2,1}; |
| 901 | static const int divs[] = {2,4,6,12}; |
| 902 | return LowerBoundStep(max_divs, divs, step, 4); |
| 903 | } |
| 904 | return 0; |
| 905 | } |
| 906 | |
| 907 | ImPlotTime MkGmtTime(struct tm *ptm) { |
| 908 | ImPlotTime t; |
no test coverage detected