Files correlati : Ricompilazione Demo : [ ] Commento : Aggiunti i sorgenti per Greenleaf Math Library (gfm.dll) git-svn-id: svn://10.65.10.50/trunk@10079 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			60 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			60 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
/* int	DaysBetweenDates360(m1,d1,y1, m2,d2,y2)
 | 
						|
 *
 | 
						|
 * ARGUMENT
 | 
						|
 *  int	m1,d1,y1;		- Base Date
 | 
						|
 *  int	m2,d2,y2;		- Date to compare with base
 | 
						|
 *
 | 
						|
 * DESCRIPTION
 | 
						|
 *  Compares two dates in date args format, forming the	difference in
 | 
						|
 *  whole days.	 The result is a signed	number:
 | 
						|
 *
 | 
						|
 *  In this one, all months are	30 days	(e.g. year is 360 days).
 | 
						|
 *
 | 
						|
 *	0 if dates are same,
 | 
						|
 *	+n if date1 > date2
 | 
						|
 *	-n if date1 < date2
 | 
						|
 *
 | 
						|
 * SIDE	EFFECTS
 | 
						|
 *	None.
 | 
						|
 *
 | 
						|
 * RETURNS
 | 
						|
 *  +,-, or 0 days.  0 can indicate an error.
 | 
						|
 *
 | 
						|
 * POSSIBLE ERROR CODES
 | 
						|
 *	GM_ARGVAL
 | 
						|
 *	GM_OVERFLOW
 | 
						|
 *
 | 
						|
 * AUTHOR
 | 
						|
 *     05-Aug-1987  12:43:39
 | 
						|
 *   Copyright (C) 1987-1990 Greenleaf Software	Inc.  All rights reserved.
 | 
						|
 *
 | 
						|
 * MODIFICATIONS
 | 
						|
 */
 | 
						|
#include <stdio.h>
 | 
						|
#include "gmsystem.h"
 | 
						|
 | 
						|
int DaysBetweenDates360(m1,d1,y1,m2,d2,y2)
 | 
						|
int m1,d1,y1,m2,d2,y2;
 | 
						|
{
 | 
						|
	long	n;
 | 
						|
 | 
						|
	_MacStart(GM_DBD360);
 | 
						|
	if (m1<1||m1>12||d1<1||d1>31||y1<0||y1>9999||
 | 
						|
		m2<1||m2>12||d2<1||d2>31||y2<0||y2>9999) {
 | 
						|
		_MacErr(GM_ARGVAL);
 | 
						|
		_MacRet(0);
 | 
						|
	}
 | 
						|
 | 
						|
	if (d2==31)
 | 
						|
		d2=30;
 | 
						|
	if (d1==31 && d2>=30)
 | 
						|
		d1=30;
 | 
						|
	n = (long) (y1-y2) * 360L + (long) ((m1	- m2) *	30 + (d1 - d2));
 | 
						|
	if (n<-32768L || n>32767L)  {
 | 
						|
		_MacErr(GM_OVERFLOW);
 | 
						|
		_MacRet(0);
 | 
						|
	}
 | 
						|
 | 
						|
	_MacRet((int) n);
 | 
						|
}
 |