Fill the datetime struct from the value and resolution unit.
Note that what looks like val / N and val % N for positive numbers maps to [val - (N-1)] / N and [N-1 + (val+1) % N] for negative numbers (with the 2nd value, the remainder, being positive in both cases).
A week is the same as 7 days
Number of business days since Thursday, 1-1-70
A buisness day is M T W Th F (i.e. all but Sat and Sun.) Convert the business day to the number of actual days.
- Must convert [0,1,2,3,4,5,6,7,...] to
- [0,1,4,5,6,7,8,11,...]
- and [...,-9,-8,-7,-6,-5,-4,-3,-2,-1,0] to
- [...,-13,-10,-9,-8,-7,-6,-3,-2,-1,0]
Recall how C computes / and % with negative numbers
entire range is only += 2.6 hours
tmp (number of fs) will be positive after this segment
we are at the last second
entire range is only += 9.2 seconds