File: logtime.x

package info (click to toggle)
iraf-rvsao 2.8.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 16,456 kB
  • sloc: ansic: 963; lisp: 651; fortran: 397; makefile: 27
file content (38 lines) | stat: -rw-r--r-- 1,019 bytes parent folder | download
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
# File rvsao/Util/logtime.x
# October 1, 1997
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
# Modified from sys/misc/cnvtime.x
# Modified by Doug Mink, Harvard-Smithsonian Center for Astrophysics

include	<time.h>

define	SZ_MONTH		3

# LOGTIME -- Return current time as a string, i.e., " 17-Mar-1982 16:30".
# The maximum length of the returned string is given by the parameter
# SZ_TIME in <time.h>.

procedure logtime (outstr, maxch)

char	outstr[maxch]
int	maxch

int	tm[LEN_TMSTRUCT]	# broken down time structure
string	month	"JanFebMarAprMayJunJulAugSepOctNovDec"
long	ltime			# seconds since 00:00:00 10-Jan-80
long	clktime()

begin
	ltime = 0
	ltime = clktime (ltime)
	call brktime (ltime+30, tm)
	
	call sprintf (outstr, maxch, " %02d-%3.3s-%04d %02d:%02d")
	    call pargi (TM_MDAY(tm))
	    call pargstr (month [(TM_MONTH(tm) - 1) * SZ_MONTH + 1])
	    call pargi (TM_YEAR(tm))
	    call pargi (TM_HOUR(tm))
	    call pargi (TM_MIN(tm))
end

# Oct  1 1997	Print 4-digit year