blob: 03fa5db8baf3c3377b13a74d5ad6e65109a739d1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
*/
#include <stdio.h>
#include <sys/types.h>
#include <time.h>
#define import_kernel
#define import_knames
#define import_spp
#include <iraf.h>
#define SECONDS_1970_TO_1980 315532800L
/* ZGMTCO -- Return the correction, in seconds, from local standard time
* (clock time) to GMT. GMT = LST + gmtco (seconds), or gmtco = GMT-LST.
*/
int
ZGMTCO (
XINT *gmtcor /* seconds */
)
{
time_t gmt_to_lst(), ltime;
/* Given an input value of zero (biased by SECONDS_1970_TO_1980)
* gmt_to_lst will return a negative value in seconds for a location
* in the US (as an limiting test case). We want to return the
* correction to LST to get GMT, a positive value for the US, so
* we need to negate this value. gmt_to_lst will already have taken
* daylight savings time into account. Although we talk about the
* US (as a test case) this relation will hold both east and west
* of Greenwich.
*/
*gmtcor = -((XINT) gmt_to_lst ((time_t) SECONDS_1970_TO_1980));
/* Daylight saving time is not added to the output of gmt_to_lst()
* since it assumes Jan 1. Use the current date to determin if
* DST is in effect.
*/
ltime = time(0);
if (localtime(<ime)->tm_isdst)
*gmtcor = *gmtcor - 60L * 60L;
return (XOK);
}
|