utc.h
1/***************************************************************************
2 *
3 * Copyright (C) 1998 by Willem van Straten
4 * Licensed under the Academic Free License version 2.1
5 *
6 ***************************************************************************/
7
8// psrchive/Util/genutil/utc.h
9
10/* ************************************************************************
11
12 UTC time structure - a subset of 'struct tm' used when you don't know
13 or want to calculate neither the day of month nor month of year.
14
15 ************************************************************************ */
16
17#ifndef UTC_H
18#define UTC_H
19
20#include <time.h>
21
22typedef struct {
23 int tm_sec;
24 int tm_min;
25 int tm_hour;
26 int tm_yday;
27 int tm_year;
28} utc_t;
29
30#define UTC_INIT {0,0,0,0,0}
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36int str2utc (utc_t *time, const char* str);
37char* utc2str (char* str, utc_t time, const char* fmt);
38char* utcstrfill (char* str, utc_t time, int fill_chars);
39int utc_diff (utc_t time1, utc_t time2);
40int utc_inc (utc_t *time, int seconds);
41int utc_dec (utc_t *time, int seconds);
42
43int tm2utc (utc_t *time, struct tm caltime);
44int utc2tm (struct tm *caltim, utc_t time);
45
46int utc_f2LST (double* lst, utc_t timeutc, double fracsec, float longitude);
47int utc2LST (double* lst, utc_t timeutc, float east_longitude);
48
49#ifdef __cplusplus
50}
51#endif
52
53#define UTC_LEAPYEAR(year) ( ((year)%4 == 0) && \
54 (((year)%100 != 0) || ((year)%400 == 0)) )
55#define UTC_JULIANDAYS(year) ( 365 + ((UTC_LEAPYEAR(year))?1:0) )
56
57#endif
58

Generated using doxygen 1.14.0