Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Marko Rauhamaa <marko@pacujo.net> |
|---|---|
| Newsgroups | comp.misc |
| Subject | Re: The 8-Byte Two-Step |
| Date | 2014-09-23 11:19 +0300 |
| Organization | A noiseless patient Spider |
| Message-ID | <87egv27npt.fsf@elektro.pacujo.net> (permalink) |
| References | <01T8OImfoeUtayhTm1xJJ0vS@dont-email.me> <c86928Fkug2U4@mid.individual.net> <87ppeq2car.fsf@elektro.pacujo.net> <c87gfnFkjjcU1@mid.individual.net> <87d2ap2pjn.fsf@elektro.pacujo.net> |
Marko Rauhamaa <marko@pacujo.net>:
> def gregorian_day_count(isodate):
> year, month, day = map(int, isodate.split('-'))
> a, b = divmod(12 * year + month - 3, 12)
> yeardays = a * 365 + a // 4 - a // 100 + a // 400
> return yeardays + int(30.573 * b + 0.706) + day
Or, if you will:
def gregorian_day_count(isodate):
year, month, day = map(int, isodate.split('-'))
a, b = divmod(12 * year + month - 3, 12)
return (a * 365 + (a >> 2) - (a * 1311 >> 17) + (a * 1311 >> 19) +
+ (31306 * b + 722 >> 10))
Marko
Back to comp.misc | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
The 8-Byte Two-Step Rich <rich@example.invalid> - 2014-09-20 20:41 +0000
Re: The 8-Byte Two-Step Bob Eager <news0002@eager.cx> - 2014-09-20 21:14 +0000
Re: The 8-Byte Two-Step Marko Rauhamaa <marko@pacujo.net> - 2014-09-21 00:48 +0300
Re: The 8-Byte Two-Step Bob Eager <news0002@eager.cx> - 2014-09-21 08:27 +0000
Re: The 8-Byte Two-Step Marko Rauhamaa <marko@pacujo.net> - 2014-09-21 14:14 +0300
Re: The 8-Byte Two-Step Marko Rauhamaa <marko@pacujo.net> - 2014-09-23 11:19 +0300
Re: The 8-Byte Two-Step Christian Neukirchen <chneukirchen@gmail.com> - 2014-09-23 18:26 +0200
Re: The 8-Byte Two-Step mm0fmf <none@mailinator.com> - 2014-09-21 20:45 +0100
Re: The 8-Byte Two-Step Sylvia Else <sylvia@not.at.this.address> - 2014-09-21 13:42 +1000
csiph-web