108{
109
110 if (d < 0.0 && (d + minor > 0.0))
111 d = 0.0;
112
114 if (d < 0) {
115 return;
116 }
117
118#if ALWAYS_HH_MM_SS
119 int secs = (int)(d + 0.5);
120 if (mMinor >= 1.0) {
121 s.Printf(
wxT(
"%d:%02d:%02d"), secs / 3600, (secs / 60) % 60, secs % 60);
122 }
123 else {
125 t1.Printf(
wxT(
"%d:%02d:"), secs / 3600, (secs / 60) % 60);
126 format.Printf(
wxT(
"%%0%d.%dlf"), mDigits + 3, mDigits);
127 t2.Printf(
format, fmod(d, 60.0));
128 s += t1 + t2;
129 }
130 break;
131#endif
132
133 if (minor >= 3600.0) {
134 int hrs = (int)(d / 3600.0 + 0.5);
135 wxString h;
136 h.Printf(
wxT(
"%d:00:00"), hrs);
137 s += h;
138 }
139 else if (minor >= 60.0) {
140 int minutes = (int)(d / 60.0 + 0.5);
141 wxString m;
142 if (minutes >= 60)
143 m.Printf(
wxT(
"%d:%02d:00"), minutes / 60, minutes % 60);
144 else
145 m.Printf(
wxT(
"%d:00"), minutes);
146 s += m;
147 }
148 else if (minor >= 1.0) {
149 int secs = (int)(d + 0.5);
150 wxString t;
151 if (secs >= 3600)
152 t.Printf(
wxT(
"%d:%02d:%02d"), secs / 3600, (secs / 60) % 60, secs % 60);
153 else if (secs >= 60)
154 t.Printf(
wxT(
"%d:%02d"), secs / 60, secs % 60);
155 else
156 t.Printf(
wxT(
"%d"), secs);
157 s += t;
158 }
159 else {
160
161
162
163#if 0
164
165
166 int secs = (int)(float)(d);
168
169 if (secs >= 3600)
170 t1.Printf(
wxT(
"%d:%02d:"), secs / 3600, (secs / 60) % 60);
171 else if (secs >= 60)
172 t1.Printf(
wxT(
"%d:"), secs / 60);
173
174 if (secs >= 60)
175 format.Printf(
wxT(
"%%0%d.%dlf"), mDigits + 3, mDigits);
176 else
177 format.Printf(
wxT(
"%%%d.%dlf"), mDigits + 3, mDigits);
178
179
180 t2.Printf(
format, fmod((
float)d, (float)60.0));
181#else
182
183
184
185
186 double dd = d * 1.000000000000001;
187 int secs = (int)(dd);
189
190 if (secs >= 3600)
191 t1.Printf(
wxT(
"%d:%02d:"), secs / 3600, (secs / 60) % 60);
192 else if (secs >= 60)
193 t1.Printf(
wxT(
"%d:"), secs / 60);
194
195 if (secs >= 60)
196 format.Printf(
wxT(
"%%0%d.%dlf"), mDigits + 3, mDigits);
197 else
198 format.Printf(
wxT(
"%%%d.%dlf"), mDigits + 3, mDigits);
199
200 dd = dd - secs + (secs % 60);
201
202
203 double multiplier = pow(10, mDigits);
204 dd = ((int)(dd * multiplier)) / multiplier;
206#endif
207 s += t1 + t2;
208 }
209 }
210}