DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ T w

⟦2fd88cfcd⟧ TextFile

    Length: 2511 (0x9cf)
    Types: TextFile
    Names: »ws_stamp_f.c«

Derivation

└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
    └─ ⟦0c25cb74a⟧ »DATA« 
        └─⟦038380b96⟧ 
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
    └─ ⟦f494b5154⟧ »DATA« 
        └─⟦038380b96⟧ 
            └─ ⟦this⟧ »ws_stamp_f.c« 
└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
    └─ ⟦0c25cb74a⟧ »DATA« 
        └─⟦0732ea0cf⟧ 
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
    └─ ⟦f494b5154⟧ »DATA« 
        └─⟦0732ea0cf⟧ 
            └─ ⟦this⟧ »../../dtia/release_apollo_2.1/ws_stamp_f.c« 
└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
    └─ ⟦0c25cb74a⟧ »DATA« 
        └─⟦25fab149a⟧ 
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
    └─ ⟦f494b5154⟧ »DATA« 
        └─⟦25fab149a⟧ 
            └─ ⟦this⟧ »../../dtia/release_sun_2.1/ws_stamp_f.c« 
└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
    └─ ⟦0c25cb74a⟧ »DATA« 
        └─⟦be254d495⟧ 
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
    └─ ⟦f494b5154⟧ »DATA« 
        └─⟦be254d495⟧ 
            └─ ⟦this⟧ »../../dtia/release_aix_2.1/ws_stamp_f.c« 
└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
    └─ ⟦0c25cb74a⟧ »DATA« 
        └─⟦c67979795⟧ 
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
    └─ ⟦f494b5154⟧ »DATA« 
        └─⟦c67979795⟧ 
            └─ ⟦this⟧ »../../dtia/release_hp_2.1/ws_stamp_f.c« 

TextFile

#ifndef	lint
#ifndef	DEBUG
static char SCCS_id[] = "@(#)ws_stamp_f.c 2.1 90/08/02 19:04:33  Copyright(c) 1990 by Rational.";
#else
static char SCCS_id[] = "@(#)ws_stamp_f.c DEBUG 2.1 90/08/02 19:04:33  Copyright(c) 1990 by Rational.";
#endif
#endif

#define	WS_STAMP_F
#include	"talk.h"
#undef	WS_STAMP_F

extern	int	errno;
static	int	mod_time=0;
static	int	error_number = E_OK;

#define	INF	0
#define	SUP	1
#define	EQUAL	2

struct	struct_time {
	int	year;
	int	day;
	int	hour;
	int	min;
	int	sec;
};

static	int	compare(t1,t2)
struct	struct_time	*t1,*t2; 
{

	if (t1->year < t2->year)	return	INF;
	if (t1->year > t2->year)	return	SUP;

	if (t1->day < t2->day)	return	INF;
	if (t1->day > t2->day)	return	SUP;

	if (t1->hour < t2->hour)	return	INF;
	if (t1->hour > t2->hour)	return	SUP;

	if (t1->min < t2->min)	return	INF;
	if (t1->min > t2->min)	return	SUP;

	if (t1->sec < t2->sec)	return	INF;
	if (t1->sec > t2->sec)	return	SUP;

	return	EQUAL;
}

static	int	diff(t1,t2)
struct	struct_time	*t1,*t2; 
{
	int	negative = FALSE;
	struct	struct_time	*t;
	if	(compare(t1,t2) == SUP) {
		t = t1;
		t1 = t2;
		t2 = t;
		negative = TRUE;
	}
	if (t1->year < t2->year) {
		if (t1->year+1 != t2->year)	return(0);
		if ((t1->day!=364) &&
		    (t1->day!=365))			return(0);
		if (t2->day!=0)			return(0);
		/* The three last cases are errors	*/
		t1->year++;
		t1->day=0;
	}
	/* The years are now equal	*/
	return	(negative?-1:1)	*
	    (	(t2->sec - t1->sec)		+
	    (t2->min - t1->min) * 60		+
	    (t2->hour- t1->hour)*3600		+
	    (t2->day- t1->day)*3600*24
	    );

}

static	void	set_structs(clock,loc,gmt)
long	clock;
struct	struct_time	*loc,*gmt; 
{
	struct	tm	*p;
	p = localtime(&clock);
	loc->year = p->tm_year;
	loc->day  = p->tm_yday;
	loc->hour = p->tm_hour;
	loc->min  = p->tm_min;
	loc->sec  = p->tm_sec;
	p = gmtime(&clock);
	gmt->year = p->tm_year;
	gmt->day  = p->tm_yday;
	gmt->hour = p->tm_hour;
	gmt->min  = p->tm_min;
	gmt->sec  = p->tm_sec;
}

int	last_update_f_of_remote_file_in(f)
char	*f; 
{
	int	error;
	struct	stat	s;

	error_number = E_OK;
	error = stat(f,&s);
	if (error == -1)	error_number = errno;
	mod_time = (error== -1) ? 0 : (s.st_mtime);
	return	E_OK;
}

int	last_update_f_options_in(options)
char	*options; 
{
	return	E_OK;
}

int	last_update_f_in_seconds_out(i)
int	*i; 
{
	struct	struct_time	loc_time,gmt_time;
	long	clock = mod_time;
	set_structs(clock,&loc_time,&gmt_time);
	*i=mod_time+diff(&gmt_time,&loc_time);
	return	E_OK;
}

int	last_update_f_end() {
	return	error_number;
}