![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Algorithm In Pseudocode | delsega | UNIX for Advanced & Expert Users | 1 | 03-10-2008 08:10 AM |
| algorithm | filthymonk | Shell Programming and Scripting | 5 | 07-20-2007 12:13 AM |
| Help in Search Algorithm | bourne | SUN Solaris | 1 | 10-24-2005 10:33 AM |
| FTP's algorithm | toughguy2handle | High Level Programming | 1 | 09-23-2005 11:52 AM |
| Feedback algorithm | messier79 | High Level Programming | 0 | 03-17-2004 05:42 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Algorithm problem
Looking for an algorithm to compute the number of days between two given dates I came across a professor's C program located here: http://cr.yp.to/2001-275/struct1.c
I was wondering if anyone could tell me where the value 678882 in the line int d = dateday - 678882; comes from and also the line d += (306 * m + 5) / 10; where these numbers come from and their purpose. Thanks. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
The code is doing civil date to Julian date conversion, then subtracting. Julian date algorithms are, um, interesting. The big numbers relate to the epoch used for the calculation vs the data range expected in the civil calendar. I don't know where his particular numbers came from.
See: http://scienceworld.wolfram.com/astr...ulianDate.html |
|||
| Google The UNIX and Linux Forums |