Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Marko Rauhamaa <marko@pacujo.net> |
| Newsgroups | comp.misc |
| Subject | Re: The 8-Byte Two-Step |
| Date | Sun, 21 Sep 2014 00:48:44 +0300 |
| Organization | A noiseless patient Spider |
| Lines | 37 |
| Message-ID | <87ppeq2car.fsf@elektro.pacujo.net> (permalink) |
| References | <01T8OImfoeUtayhTm1xJJ0vS@dont-email.me> <c86928Fkug2U4@mid.individual.net> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Injection-Info | mx05.eternal-september.org; posting-host="ff5cf27ef3d5b31f034d3b72bdc27a41"; logging-data="13321"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19QK0FgRUukDwoX2FkvGWbP" |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) |
| Cancel-Lock | sha1:HB+QMK03+OSl2wGAoNlIpTv2yrU= sha1:3VmtvGuY1MoEYEt1qZBh6sHMS/k= |
| Xref | csiph.com comp.misc:5008 |
Show key headers only | View raw
Bob Eager <news0002@eager.cx>:
>> (mqhp->mq_maxsz + MQ_ALIGNSIZE - 1) & ~(MQ_ALIGNSIZE - 1);
>
> Standard bit of code. I can't remember when I didn't know that one!
Yes, but I suppose the knowledge is fast eroding among coders. I can't
remember having been taught it. I must have learned it from other
people's assembly and C code.
Somehow that reminds me of an ancient trick I learned from some TI-56
program. Here's a compact way to figure out how many days are between
any (ISO 8601) dates:
========================================================================
#!/usr/bin/env python
import sys
def gregorian_day_count(isodate):
year, month, day = map(int, isodate.split('-'))
a, b = divmod(12 * year + month + 1185, 12)
return int(a * 365.2425) + int(30.573 * b + 0.706) + day
def main():
print gregorian_day_count(sys.argv[2]) - gregorian_day_count(sys.argv[1])
if __name__ == '__main__':
main()
========================================================================
Usage:
./datediff.py 1960-02-03 2014-09-09
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