/**********************************************************************
 
	Copyright (C) 2003 Hirohisa MORI <joshua@nichibun.ac.jp>
 
	This program is free software; you can redistribute it 
	and/or modify it under the terms of the GLOBALBASE 
	Library General Public License (G-LGPL) as published by 

	http://www.globalbase.org/
 
	This program is distributed in the hope that it will be 
	useful, but WITHOUT ANY WARRANTY; without even the 
	implied warranty of MERCHANTABILITY or FITNESS FOR A 
	PARTICULAR PURPOSE.

**********************************************************************/



#include	"gbgraph.h"


int
cmp_gb_time_set(char a,char b)
{
	if ( !(a < 0 && b < 0) ) {
		if ( a < 0 )
			return 1;
		if ( b < 0 )
			return -1;
		if ( a < b )
			return -1;
		if ( a > b )
			return 1;
	}
	return 0;
}


int
cmp_gb_time(GB_TIME * t1,GB_TIME * t2)
{
int ret;
	if ( t1->year < t2->year )
		return -1;
	if ( t1->year > t2->year )
		return 1;
	ret = cmp_gb_time_set(t1->month,t2->month);
	if ( ret )
		return ret;
	ret = cmp_gb_time_set(t1->date,t2->date);
	if ( ret )
		return ret;
	ret = cmp_gb_time_set(t1->day,t2->day);
	if ( ret )
		return ret;
	ret = cmp_gb_time_set(t1->hour,t2->hour);
	if ( ret )
		return ret;
	ret = cmp_gb_time_set(t1->min,t2->min);
	if ( ret )
		return ret;
	ret = cmp_gb_time_set(t1->sec,t2->sec);
	if ( ret )
		return ret;
	return 0;
}
