| Q D E V _ H L P _ T V T O D S ( )
| | | | | SOURCE: qdev_macros.txt 1.16 (12/09/2014) English
AMIGA - PUBLIC
----------------------------------------------------------------------------
NAME
QDEV_HLP_TVTODS() - Converts from timeval notation to
DateStamp.
SYNOPSIS
QDEV_HLP_TVTODS(ds, tv);
QDEV_HLP_TVTODS(struct DateStamp *, struct timeval *);
FUNCTION
This macro allows to convert from higher resolution tv
to lower resolution ds time holder.
INPUTS
ds - DateStamp pointer whose fields will be computed
from timeval.
tv - Timeval holder.
RETURNS
No output.
BASES
None.
NOTES
This macro is useful when one wants to manipulate the
time and date as it is simplier to subtract or add two
timevals than DateStamps.
This macro due to high arithmetic load(including div.)
is somewhat unsuitable for time critical use.
SEE ALSO
QDEV_HLP_DSTOTV()
EXAMPLE
#include <proto/dos.h>
#include <qdev.h>
int main(void)
{
struct DateTime dat;
struct timeval dst;
struct timeval src;
UBYTE buftime[LEN_DATSTRING] =
{'0', '0', ':', '0', '0', ':', '0', '0', 0};
DateStamp(&dat.dat_Stamp);
QDEV_HLP_DSTOTV(&src, &dat.dat_Stamp);
Delay(50);
DateStamp(&dat.dat_Stamp);
QDEV_HLP_DSTOTV(&dst, &dat.dat_Stamp);
QDEV_HLP_SUBTV(&dst, &src);
QDEV_HLP_TVTODS(&dat.dat_Stamp, &dst);
dat.dat_Format = FORMAT_DOS;
dat.dat_Flags = 0;
dat.dat_StrDay = NULL;
dat.dat_StrDate = NULL;
dat.dat_StrTime = buftime;
DateToStr(&dat);
FPrintf(Output(), "%03ld:%s\n",
dat.dat_Stamp.ds_Days, (LONG)dat.dat_StrTime);
return 0;
}
BUGS
None known.
----------------------------------------------------------------------------
| |
| |