mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
helper: Added quantizeTo15Minutes
This commit is contained in:
parent
24bb8ade7a
commit
13c340f251
2 changed files with 17 additions and 0 deletions
|
@ -557,3 +557,19 @@ std::map <std::string, Color> createTagColorMap (
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int quantizeTo15Minutes (const int minutes)
|
||||
{
|
||||
if (minutes == 0 ||
|
||||
minutes == 15 ||
|
||||
minutes == 45 ||
|
||||
minutes == 60)
|
||||
return minutes;
|
||||
|
||||
auto deviation = minutes % 15;
|
||||
if (deviation < 8)
|
||||
return minutes - deviation;
|
||||
|
||||
return minutes + 15 - deviation;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -59,6 +59,7 @@ std::vector <Range> subtractRanges (const Range&, const std::vector <Range>&, co
|
|||
Range overallRangeFromIntervals (const std::vector <Interval>&);
|
||||
std::vector <Range> combineHolidaysAndExclusions (const Range&, const Rules&, const std::vector <Exclusion>&);
|
||||
std::map <std::string, Color> createTagColorMap (const Rules&, Palette&, const std::vector <Interval>&);
|
||||
int quantizeTo15Minutes (const int);
|
||||
|
||||
// utiŀ.cpp
|
||||
std::string osName ();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue