#if !defined(PS_DATE_TIME_H)
#define PS_DATE_TIME_H

#include "taia.h"

/** \file psDateTime.h
 *  \brief Dates and Times
 *  \ingroup AstroGroup
 *  
 *  The functions in this file define a set of conversions between different time systems and representations.
 *  All convert to and from the PSLib internal time data value (TAI - TBR).  Available time representations
 *  include: TAI (taia type), UTC (?), MJD (double?), ISO ISO point-in-time (YYYY-MM-DD,HH:MM:SS.SSS),
 */

/** \addtogroup AstroGroup Astronomy-Specific Utilities
 *  \{
 */

/** psTime is the time structure we will use throughout.  This needs to be revised.  If we end up wrapping
    libTAI, then we'll probably just use their time struct.  But until then, we need this temporary
    definition. */
typedef struct {
  struct taia t;
} psTime;


/** Get current MJD, for a timestamp \ingroup AstroGroup */
double
psGetMJD(void);

/** Get current sidereal time at longitude \ingroup AstroGroup */
double
psGetSidereal(float mjd,		///< MJD
	      float longitude)		///< Longitude
;

/***** convert from psTime *****/
/** Convert psTime to ISOTime (Human-readable date/time string YYYY/MM/DD,HH:MM:SS.SSS) */
char *
psTimeToISOTime (psTime time)		///< Input psTime time
;

/** Convert psTime to UTC */
double
psTimeToUTC (psTime time)		///< Input psTime time
;

/** Convert psTime to MJD */
double
psTimeToMJD (psTime time)		///< Input psTime time
;

/** Convert psTime to JD */
double
psTimeToJD (psTime time)		///< Input psTime time
;

/** Convert psTime to timeval (struct timeval) */
struct timeval *
psTimeToTimeval (psTime time)		///< Input psTime time
;

/** Convert psTime to broken-down time (struct tm) */
struct tm *				
psTimeToTm (psTime time)		///< Input psTime time
;

/** Convert psTime to lunation number */
float
psTimeToLunation (psTime time)		///< Input psTime time
;

/***** convert to psTime *****/
/** Convert ISOTime (Human-readable date/time string YYYY/MM/DD,HH:MM:SS.SSS) to psTime \ingroup AstroGroup */
psTime *
psISOTimeToTime (char *input)		///< Input ISOTime time
;

/** Convert UTC to psTime */
psTime *
psUTCToTime (double input)		///< Input UTC time
;

/** Convert MJD to psTime */
psTime *
psMJDToTime (double input)		///< Input MJD time
;

/** Convert JD to psTime */
psTime *
psJDToTime (double input)		///< Input JD time
;

/** Convert timeval (struct timeval) to psTime */
psTime *
psTimevalToTime (struct timeval *input)	///< Input timeval time
;

/** Convert broken-down time (struct tm) to psTime */
psTime *
psTMToTime (struct tm *input)		///< Input tm time
;

/** Convert lunation number to psTime */
psTime *
psLunationToTime (float lunation)	///< Input lunation
;

/* \} end of AstroGroup */

#endif

/* date/time representations of interest:

  TAI - 
  UTC - long? float? double?
  MJD - double?
  ISO - yyyy-mm-dd hh:mm:ss +oooo
  point-in-time YYYY/MM/DD,HH:MM:SS.SSS
  timeval
  
*/
