The progress sums: seconds gone over seconds in the period, as a whole percent.
More...
|
| static int | pct_of_seconds (int elapsed, int total) |
| | Seconds gone over seconds in the period, as a whole percent rounded down.
|
| static int | seconds_into_day (int hour, int min, int sec) |
| | How many seconds of the day have gone by on the wall clock.
|
| static int | days_in_year (int year) |
| | How many days a year has, 365 or 366.
|
| int | progress_week_day (int wday, int week_start) |
| | How many days the week has run, counting the first day as day 1.
|
| int | progress_hour_pct (int min, int sec) |
| | How far through the current hour it is.
|
| int | progress_day_pct (int hour, int min, int sec) |
| | How far through the current day it is.
|
| int | progress_week_pct (int wday, int week_start, int hour, int min, int sec) |
| | How far through the current week it is, counting from the day the week starts on.
|
| int | progress_year_pct (int year, int yday, int hour, int min, int sec) |
| | How far through the current year it is, with February getting its leap day.
|
The progress sums: seconds gone over seconds in the period, as a whole percent.
| int pct_of_seconds |
( |
int | elapsed, |
|
|
int | total ) |
|
static |
Seconds gone over seconds in the period, as a whole percent rounded down.
Every period is a whole number of hours, so a hundredth of one is a whole number of seconds, 36 an hour. Dividing by that hundredth gives the same answer as times 100 over the total, with no product that could run past a 32 bit int on a year of seconds. It also keeps 64 bit division, about 750 bytes of library code, off the watch.
- Parameters
-
| elapsed | Seconds gone so far. |
| total | Seconds in the whole period, a whole number of hours. |
- Returns
- Whole percent from 0 to 99, or 0 when either count is not positive.