The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
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

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 07-23-2004
Registered User
 

Join Date: Jul 2004
Posts: 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.
Reply With Quote
Forum Sponsor
  #2  
Old 07-26-2004
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,271
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
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 05:44 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0