Lista de discussão de MAC 2301
[Prévia por Data][Próxima por Data]
[Prévia por Assunto][Próxima por Assunto]
[Índice por Data][Índice por Assunto]
[Envie uma nova mensagem para a lista]
[Responda esta mensagem]
time
#include <sys/time.h>
int gettimeofday(struct timeval *tp,
struct timezone *tzp);
DESCRIPTION
When gettimeofday() is called under HP-UX, extensions apply to the
time zone parameter, the return value, and errors.
If the tzp parameter is not a null pointer, it is interpreted as a
pointer to a struct timezone under HP-UX. The struct timezone has
the
following fields:
tz_minuteswest The number of minutes that the local time zone is
west of UTC.
tz_dsttime A flag that, if nonzero, indicates that Daylight
Savings Time (DST) applies locally during the
appropriate part of the year.
Programs should use this time zone information only in the absence
of
the TZ environment variable.
Security Restrictions
Only a user with appropriate privileges can set the time of day.
RETURN VALUE
gettimeofday() return the following values under HP-UX:
0 Successful completion.
-1 Failure. errno is set to indicate the error.
ERRORS
If gettimeofday() fails, errno is set to the following value under
HP-UX:
[EFAULT] An argument address referenced invalid memory.
The reliable detection of this error is
implementation dependent.
EXAMPLES
The following HP-UX example calls gettimeofday() twice. It then
computes the lapsed time between the calls in seconds and
microseconds
and stores the result in a timeval structure:
struct timeval first,
second,
lapsed;
struct timezone tzp;
gettimeofday (&first, &tzp);
/* lapsed time */
gettimeofday (&second, &tzp);
if (first.tv_usec > second.tv_usec) {
second.tv_usec += 1000000;
second.tv_sec--;
}
lapsed.tv_usec = second.tv_usec - first.tv_usec;
lapsed.tv_sec = second.tv_sec - first.tv_sec;
--
/*----------------------------------------------------------------
Daniel da Silva Lacerda
Graduando em Engenharia Eletrica - daniel.lacerda@poli.usp.br
Laboratorio de Tecnicas Inteligentes - www.lti.pcs.usp.br
Escola Politecnica da USP - www.poli.usp.br
------------------------------------------------Powered by Linux*/