定为 21 天,我就想知道到底每个月我工作了多少天,这个问题以前从来没想过...
经测试
ox0spy@ubuntu:/code/python$ ./workday.py -y 2009
2009-01 : 22
2009-02 : 20
2009-03 : 22
2009-04 : 22
2009-05 : 21
2009-06 : 22
2009-07 : 23
2009-08 : 21
2009-09 : 22
2009-10 : 22
2009-11 : 21
2009-12 : 23
2009 total work day : 261
以后52年
ox0spy@ubuntu:/code/python$ ./workday.py -s 2009 -e 2060
[2009] real work day: 261
[2010] real work day: 261
[2011] real work day: 260
[2012] real work day: 261
[2013] real work day: 261
[2014] real work day: 261
[2015] real work day: 261
[2016] real work day: 261
[2017] real work day: 260
[2018] real work day: 261
[2019] real work day: 261
[2020] real work day: 262
[2021] real work day: 261
[2022] real work day: 260
[2023] real work day: 260
[2024] real work day: 262
[2025] real work day: 261
[2026] real work day: 261
[2027] real work day: 261
[2028] real work day: 260
[2029] real work day: 261
[2030] real work day: 261
[2031] real work day: 261
[2032] real work day: 262
[2033] real work day: 260
[2034] real work day: 260
[2035] real work day: 261
[2036] real work day: 262
[2037] real work day: 261
[2038] real work day: 261
[2039] real work day: 260
[2040] real work day: 261
[2041] real work day: 261
[2042] real work day: 261
[2043] real work day: 261
[2044] real work day: 261
[2045] real work day: 260
[2046] real work day: 261
[2047] real work day: 261
[2048] real work day: 262
[2049] real work day: 261
[2050] real work day: 260
[2051] real work day: 260
[2052] real work day: 262
[2053] real work day: 261
[2054] real work day: 261
[2055] real work day: 261
[2056] real work day: 260
[2057] real work day: 261
[2058] real work day: 261
[2059] real work day: 261
[2060] real work day: 262
company work day : 252
total waste work day 463
ox0spy@ubuntu:/code/python$ ./workday.py -s 2009 -e 2060 | grep -E '\['
| awk '{print $5}' | sort | uniq -c
12 260
33 261
7 262
可以发现未来的52年,从来就没有少于260天的
公司的 21 * 12 = 252
而大部分公司 22 * 12 = 264
实际工作天数 * 月工资/本月的工作天数
我公司的算法 : (实际工作天数 - 1) * 月工资/21
6月工作天数应该是 : 22, 所以从我实际工作天数中减一, 我对这种算法很无语
还好我工作了4天, 要只工作一天就被减没了
有机会验证下如果本月应该工作天数为20天, 是不是发工资时 (实际工作天数 +
1) * 月工资/21 , 估计很显然...