The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 11:10 AM
algorithm filthymonk Shell Programming and Scripting 5 07-20-2007 04:13 AM
Help in Search Algorithm bourne SUN Solaris 1 10-24-2005 02:33 PM
FTP's algorithm toughguy2handle High Level Programming 1 09-23-2005 03:52 PM
Feedback algorithm messier79 High Level Programming 0 03-17-2004 08:42 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-23-2004
williamf williamf is offline
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.
  #2 (permalink)  
Old 07-26-2004
jim mcnamara jim mcnamara is online now Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,762
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
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:20 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0