Exemple #1
0
VOID
history_time(char *timeStr)
{
    SYSTIME                atime ;
    struct TMhuman         htime ;

    TMnow(&atime);
    TMbreak(&atime, &htime);
    STprintf(timeStr, ERx("%s-%s-%s"), htime.day, htime.month, htime.year);
}
Exemple #2
0
VOID
copyright_year(char *year)
{
	SYSTIME		atime ;
	struct TMhuman	htime ;

	TMnow(&atime);
	TMbreak(&atime, &htime);
	STprintf(year, ERx("%s"), htime.year);

}
Exemple #3
0
/*
** Name - SAwrite - write a record to the operating system audit trail
**
** Description:
**	This routine writes an audit record to the operating system audit trail.
**	It is preffereable though not compulsory for this routine to return 
**	asynchronously, a subsequent call to SAflush() will hand all 
**	outstanding audits to the operating system for auditing, if SAwrite() 
**	is synchronous then SAflush() will be a no-op routine. SAwrite() may 
**	buffer a number of audit records for performance before writing, if 
**	the caller wishes to guarantee writes a subsequent call to SAflush() 
**	must be used. SAwrite() should attempt, if possible, to write an
**	additional field, other than those passed in SA_AUD_REC, to the 
**	operating system audit trail, that will uniquely identify the record 
**	as an Ingres audit record. The audit trail will be identified by it's 
**	descriptior passed back	from SAopen().
**	
** Inputs:
**	aud_trail_d     a descriptor that identifies this audit trail
**	aud_rec         the audit record to be written
**
** Outputs:
**	err_code        pointer to a variable used to return OS errors.
**
** Returns:
**	OK              if operation succeeded
**	SA_NOOPEN       the audit trail decsribed by this descriptor has not
**			been opened
**	SA_NOWRITE      this audit trail may not be written to
**	SA_BADPARAM     bad parameter values were passed to the routine
**	SA_NOSUPP       the operation is not supported by this implimentation of
**			SA.
**	FAIL            the operation failed
**
** History:
**	7-jan-94 (stephenb)
**	    Initial creation using TRdisplay for testing.
**	28-feb-94 (stephenb)
**	    Updated to current SA spec.
*/
STATUS
SAwrite(PTR             *aud_trail_d,
	SA_AUD_REC      *aud_rec,
	CL_ERR_DESC     *err_code)
{
    /*
    ** This is a "quick and dirty routine" which just re-formats
    ** the audit record and TRdisplay's it
    */
    SYSTIME	stime;
    struct	TMhuman	time;
    char	*date;

    /*
    ** Check that the audit trail is open, this is just a dummy check
    ** that the stub routine SAopen() has been called.
    */
    if (STcompare(((SA_DESC*)*aud_trail_d)->sa_desc, "OS"))
	return (SA_NOOPEN);

    /*
    ** Get a human readable date string
    */
    TMnow(&stime);
    _VOID_ TMbreak(&stime, &time);
    _VOID_ STpolycat(7, time.wday, time.day, time.month, time.year,
	time.hour, time.mins, time.sec, &date);
    /*
    ** add null terminators to blank filled strings  (this will fail
    ** if the string already uses all 32 charaters).
    */
     _VOID_ SAtrim(aud_rec->sa_ruserid, GL_MAXNAME);
     _VOID_ SAtrim(aud_rec->sa_euserid, GL_MAXNAME);
     _VOID_ SAtrim(aud_rec->sa_dbname, GL_MAXNAME);
     _VOID_ SAtrim(aud_rec->sa_userpriv, GL_MAXNAME);
     _VOID_ SAtrim(aud_rec->sa_objpriv, GL_MAXNAME);
     _VOID_ SAtrim(aud_rec->sa_objowner, GL_MAXNAME);
     _VOID_ SAtrim(aud_rec->sa_objname, GL_MAXNAME);
    /*
    ** Send the lot to TRdisplay, not all fields are displayed, just
    ** enough to get the idea
    */
    TRdisplay("%s | %s | %s | %s | %s | %s\n", &date,
	aud_rec->sa_accesstype, aud_rec->sa_eventtype, aud_rec->sa_objname, 
	aud_rec->sa_ruserid, aud_rec->sa_dbname);
    
    return (OK);
}
Exemple #4
0
void
rfapi_getDateTime( char *dtbuf )
{
    SYSTIME	tm; /* system time in seconds */
    struct TMhuman	dthuman; /* human readable date and time structure */

    /* get the system time */
    TMnow( &tm );

    /* break it up into human readable format */
    TMbreak( &tm, &dthuman );

    STprintf( dtbuf, RFAPI_DATE_FORMAT,
		dthuman.wday,
		dthuman.month,
		dthuman.day,
		dthuman.hour,
		dthuman.mins,
		dthuman.sec,
		dthuman.year );
} 
Exemple #5
0
/*{
** Name: TMstamp_str	- Convert a stamp to a string.
**
** Description:
**      Convert a stamp to a string of the form:
**	    dd-mmm-yyyy hh:mm:ss.cc
**      Note, this routine is for the sole use of DMF for 
**      auditing and rollforward.
**
** Inputs:
**      time                            Pointer to timestamp.
**
** Outputs:
**      string                          Pointer to output string.
**					Must be TM_SIZE_STAMP bytes long.
**	Returns:
**	    void
**	Exceptions:
**	    none
**
** Side Effects:
**	    none
**
** History:
**      20-jan-1987 (Derek)
**          Created.
*/
void
TMstamp_str(
TM_STAMP	*time,
char		*string)
{
    struct TMhuman	human;
    SYSTIME		tm;
    i4			csecs;
    char		csecs_str[10];

    /* initialize the SYSTIME */

    tm.TM_secs	= time->tms_sec;
    tm.TM_msecs	= time->tms_usec / MICRO_PER_MILLI;

    if (TMbreak(&tm, &human) == OK)
    {
	/* Now format correctly "dd-mmm-yyyy hh:mm:ss.cc" */

	/* dd- */
	if (human.day[0] == ' ')
	    *string++ = '0';
	else
	    *string++ = human.day[0];
	*string++ = human.day[1];
	*string++ = '-';

	/* mmm- */
	*string++ = human.month[0];
	*string++ = human.month[1];
	*string++ = human.month[2];
	*string++ = '-';

	/* yyyy-  */
	*string++ = human.year[0];
	*string++ = human.year[1];
	*string++ = human.year[2];
	*string++ = human.year[3];
	*string++ = ' ';

	/* hh: */ 
	*string++ = human.hour[0];
	*string++ = human.hour[1];
	*string++ = ':';

	/* mm: */ 
	*string++ = human.mins[0];
	*string++ = human.mins[1];
	*string++ = ':';

	/* ss. */ 
	*string++ = human.sec[0];
	*string++ = human.sec[1];
	*string++ = '.';

	/* cc */

	/* print out 100th of second from internally stored microsecond */
	csecs = (time->tms_usec / 10000);
    	CVna(csecs, csecs_str);

	if (csecs <= 9)
	{
	    *string++ = '0';
	    *string++ = csecs_str[0];
	}
	else
	{
	    *string++ = csecs_str[0];
	    *string++ = csecs_str[1];
	}
	*string++ = '\0';
    }
    else
    {
	/* For some reason one of the conversions failed.  Since this
	** routine is currently spec'd as returning void - the best we
	** can do is return a bogus string.
	*/
	STcopy("dd-mmm-yyyy hh:mm:ss.cc", string);
    }

    return;
}