/*
 *
 * timecvt.h
 *
 * Time conversion routines.
 *
 * $Id: timecvt.h,v 1.3 2006/11/14 02:19:01 vonkorff Exp $
 *
 */

#ifndef TIMECVT_H
#define TIMECVT_H

#ifdef _WIN32
#include <sys/types.h>
#endif

struct TIME {
    int y,d,h,m,s,c;
    double tz;
    double jd;
    time_t unix_time;
};

typedef struct TIME TIME;

#define SECONDS_PER_DAY 86400

#define ISLEAP(y) ((!((y) % 4) && ((y) % 100)) || !((y) % 400))
#define NUM_DAYS(year) (365+ISLEAP(year))

extern char* jd_string(double jd);
extern char* short_jd_string(double jd);
extern double ut_to_jd(long year, long month, long day, double hour);
extern double time_t_to_jd(time_t unix_time);
extern time_t jd_to_time_t(double jd);
extern void st_time_convert(TIME *st);
extern char* hr_min_sec (double x);

#endif
/*
 * $Log: timecvt.h,v $
 * Revision 1.3  2006/11/14 02:19:01  vonkorff
 * Fixed a number of bugs in astropulse Makefile.am and configure.ac
 * Fixed bugs in makefiles
 *
 * Revision 1.2  2003/06/23 22:52:28  boincadm
 * *** empty log message ***
 *
 * Revision 1.1  2003/02/26 00:04:07  pauld
 * Initial revision
 *
 * Revision 4.0  2000/10/05 18:12:12  korpela
 * Synchronized versions to 4.0 following release of 3.0 client
 *
 * Revision 3.4  2000/06/22 09:58:19  charlief
 * MAC_OS_X: Use special Julian Date base date only if Metrowerks
 * compiler instead of for all Macintosh.
 *
 * Revision 3.3  2000/01/19 08:32:32  davea
 * *** empty log message ***
 *
 * Revision 3.2  1999/06/22 09:40:01  charlief
 * Add new function short_jd_string(), which does not print
 * Julian Date as a floating point value.
 *
 * Revision 3.1  1999/06/09 12:28:41  charlief
 * Fix Julian Date computation for Macintosh.
 *
 * Revision 2.3  1999/02/18  09:35:47  davea
 * *** empty log message ***
 *
 * Revision 2.2  1999/02/11 08:36:59  davea
 * *** empty log message ***
 *
 * Revision 2.1  1998/11/02 17:58:27  korpela
 * *** empty log message ***
 *
 * Revision 2.0  1998/10/30  22:00:04  korpela
 * Conversion to C++ and merger with client source tree.
 *
 * Revision 1.1  1998/10/19  18:58:19  korpela
 * Initial revision
 *
 *
 */
