|
|
@ -948,7 +948,7 @@ double ConVolume(double volum, int startingUnit, int endingUnit) { |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
double ConTime(double time, int startingUnit, int endingUnit) { |
|
|
|
double ConClock(double time, int startingUnit, int endingUnit) { |
|
|
|
switch (startingUnit) |
|
|
|
{ |
|
|
|
case 0: //24 to x |
|
|
@ -992,6 +992,323 @@ double ConTime(double time, int startingUnit, int endingUnit) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
double ConTime(double time, int startingUnit, int endingUnit) { |
|
|
|
switch (startingUnit) |
|
|
|
{//'ms', 's', 'min', 'h', 'd', 'w', 'mon', 'y' |
|
|
|
case 0: //ms to x |
|
|
|
switch (endingUnit) |
|
|
|
{ |
|
|
|
case 0: //ms |
|
|
|
return time; |
|
|
|
break; |
|
|
|
|
|
|
|
case 1: //s |
|
|
|
return time / 1000; |
|
|
|
break; |
|
|
|
|
|
|
|
case 2: //min |
|
|
|
return time / (1000 * 60); |
|
|
|
break; |
|
|
|
|
|
|
|
case 3: //h |
|
|
|
return time / (1000 * 60 * 60); |
|
|
|
break; |
|
|
|
|
|
|
|
case 4: //d |
|
|
|
return time / (1000 * 60 * 60 * 24); |
|
|
|
break; |
|
|
|
|
|
|
|
case 5: //w |
|
|
|
return time / (1000 * 60 * 60 * 24 * 7); |
|
|
|
break; |
|
|
|
|
|
|
|
case 6: //mon |
|
|
|
return time / (1000 * 60 * 60 * 24 * 7 * 30); |
|
|
|
break; |
|
|
|
|
|
|
|
case 7: //y |
|
|
|
return time / (1000 * 60 * 60 * 24 * 7 * 30 * 12); |
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
case 1: //s to x |
|
|
|
switch (endingUnit) |
|
|
|
{ |
|
|
|
case 0: //ms |
|
|
|
return time * 1000; |
|
|
|
break; |
|
|
|
|
|
|
|
case 1: //s |
|
|
|
return time; |
|
|
|
break; |
|
|
|
|
|
|
|
case 2: //min |
|
|
|
return time / 60; |
|
|
|
break; |
|
|
|
|
|
|
|
case 3: //h |
|
|
|
return time / (60 * 60); |
|
|
|
break; |
|
|
|
|
|
|
|
case 4: //d |
|
|
|
return time / (60 * 60 * 24); |
|
|
|
break; |
|
|
|
|
|
|
|
case 5: //w |
|
|
|
return time / (60 * 60 * 24 * 7); |
|
|
|
break; |
|
|
|
|
|
|
|
case 6: //mon |
|
|
|
return time / (60 * 60 * 24 * 7 * 30); |
|
|
|
break; |
|
|
|
|
|
|
|
case 7: //y |
|
|
|
return time / (60 * 60 * 24 * 7 * 30 * 12); |
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
case 2: //min to x |
|
|
|
switch (endingUnit) |
|
|
|
{ |
|
|
|
case 0: //ms |
|
|
|
return time * 1000; |
|
|
|
break; |
|
|
|
|
|
|
|
case 1: //s |
|
|
|
return time * 1000 * 60; |
|
|
|
break; |
|
|
|
|
|
|
|
case 2: //min |
|
|
|
return time; |
|
|
|
break; |
|
|
|
|
|
|
|
case 3: //h |
|
|
|
return time / 60; |
|
|
|
break; |
|
|
|
|
|
|
|
case 4: //d |
|
|
|
return time / (60 * 24); |
|
|
|
break; |
|
|
|
|
|
|
|
case 5: //w |
|
|
|
return time / (60 * 24 * 7); |
|
|
|
break; |
|
|
|
|
|
|
|
case 6: //mon |
|
|
|
return time / (60 * 24 * 7 * 4); |
|
|
|
break; |
|
|
|
|
|
|
|
case 7: //y |
|
|
|
return time / 60 * 24 * 7 * 4 * 12); |
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
case 3: //h to x |
|
|
|
switch (endingUnit) |
|
|
|
{ |
|
|
|
case 0: //ms |
|
|
|
return time * 1000 * 60 * 60; |
|
|
|
break; |
|
|
|
|
|
|
|
case 1: //s |
|
|
|
return time * 60 * 60; |
|
|
|
break; |
|
|
|
|
|
|
|
case 2: //min |
|
|
|
return time * 60; |
|
|
|
break; |
|
|
|
|
|
|
|
case 3: //h |
|
|
|
return time; |
|
|
|
break; |
|
|
|
|
|
|
|
case 4: //d |
|
|
|
return time / 24; |
|
|
|
break; |
|
|
|
|
|
|
|
case 5: //w |
|
|
|
return time / (24 * 7); |
|
|
|
break; |
|
|
|
|
|
|
|
case 6: //mon |
|
|
|
return time / (24 * 7 * 4); |
|
|
|
break; |
|
|
|
|
|
|
|
case 7: //y |
|
|
|
return time / (24 * 7 * 4 * 12); |
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
case 4: //d to x |
|
|
|
switch (endingUnit) |
|
|
|
{ |
|
|
|
case 0: //ms |
|
|
|
return time * 1000 * 60 * 60 * 24; |
|
|
|
break; |
|
|
|
|
|
|
|
case 1: //s |
|
|
|
return time * 60 * 60 * 24; |
|
|
|
break; |
|
|
|
|
|
|
|
case 2: //min |
|
|
|
return time * 60 * 24; |
|
|
|
break; |
|
|
|
|
|
|
|
case 3: //h |
|
|
|
return time * 24; |
|
|
|
break; |
|
|
|
|
|
|
|
case 4: //d |
|
|
|
return time; |
|
|
|
break; |
|
|
|
|
|
|
|
case 5: //w |
|
|
|
return time / 7; |
|
|
|
break; |
|
|
|
|
|
|
|
case 6: //mon |
|
|
|
return time / (7 * 4); |
|
|
|
break; |
|
|
|
|
|
|
|
case 7: //y |
|
|
|
return time / (7 * 4 * 12); |
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
case 5: //w to x |
|
|
|
switch (endingUnit) |
|
|
|
{ |
|
|
|
case 0: //ms |
|
|
|
return time * 1000 * 60 * 60 * 24 * 7; |
|
|
|
break; |
|
|
|
|
|
|
|
case 1: //s |
|
|
|
return time * 60 * 60 * 24 * 7; |
|
|
|
break; |
|
|
|
|
|
|
|
case 2: //min |
|
|
|
return time * 60 * 24 * 7; |
|
|
|
break; |
|
|
|
|
|
|
|
case 3: //h |
|
|
|
return time * 24 * 7; |
|
|
|
break; |
|
|
|
|
|
|
|
case 4: //d |
|
|
|
return time * 7; |
|
|
|
break; |
|
|
|
|
|
|
|
case 5: //w |
|
|
|
return time; |
|
|
|
break; |
|
|
|
|
|
|
|
case 6: //mon |
|
|
|
return time / 4; |
|
|
|
break; |
|
|
|
|
|
|
|
case 7: //y |
|
|
|
return time / (4 * 12); |
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
case 6: //mon to x |
|
|
|
switch (endingUnit) |
|
|
|
{ |
|
|
|
case 0: //ms |
|
|
|
return time * 1000 * 60 * 60 * 24 * 7 * 4; |
|
|
|
break; |
|
|
|
|
|
|
|
case 1: //s |
|
|
|
return time * 60 * 60 * 24 * 7 * 4; |
|
|
|
break; |
|
|
|
|
|
|
|
case 2: //min |
|
|
|
return time * 60 * 24 * 7 * 4; |
|
|
|
break; |
|
|
|
|
|
|
|
case 3: //h |
|
|
|
return time * 24 * 7 * 4; |
|
|
|
break; |
|
|
|
|
|
|
|
case 4: //d |
|
|
|
return time * 7 * 4; |
|
|
|
break; |
|
|
|
|
|
|
|
case 5: //w |
|
|
|
return time * 4; |
|
|
|
break; |
|
|
|
|
|
|
|
case 6: //mon |
|
|
|
return time; |
|
|
|
break; |
|
|
|
|
|
|
|
case 7: //y |
|
|
|
return time / 12; |
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
case 7: //y to x |
|
|
|
switch (endingUnit) |
|
|
|
{ |
|
|
|
case 0: //ms |
|
|
|
return time * 1000 * 60 * 60 * 24 * 7 * 4 * 12; |
|
|
|
break; |
|
|
|
|
|
|
|
case 1: //s |
|
|
|
return time * 60 * 60 * 24 * 7 * 4 * 12; |
|
|
|
break; |
|
|
|
|
|
|
|
case 2: //min |
|
|
|
return time * 60 * 24 * 7 * 4 * 12; |
|
|
|
break; |
|
|
|
|
|
|
|
case 3: //h |
|
|
|
return time * 24 * 7 * 4 * 12; |
|
|
|
break; |
|
|
|
|
|
|
|
case 4: //d |
|
|
|
return time * 7 * 4 * 12; |
|
|
|
break; |
|
|
|
|
|
|
|
case 5: //w |
|
|
|
return time * 4 * 12; |
|
|
|
break; |
|
|
|
|
|
|
|
case 6: //mon |
|
|
|
return time * 12); |
|
|
|
break; |
|
|
|
|
|
|
|
case 7: //y |
|
|
|
return time; |
|
|
|
break; |
|
|
|
//(1000 * 60 * 60 * 24 * 7 * 4 * 12) |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//.. |
|
|
|
// graphMode |
|
|
|