|
From: Ioannis V. <no...@ho...> - 2002-05-13 18:37:22
|
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...] On Behalf
> Of Christian Faulhammer
> Sent: Monday, May 13, 2002 7:45 PM
> To: To: dev...@li...
> Subject: [Dev-C++] System specific?
>
>
> Hello,
>
> In university I am doing a programming course and last week we had an
> excercise using a given function to measure time:
>
> ----------------------------8< schnipp------------------------------
> double MyTime() {
> struct timeval Tp;
> gettimeofday (&Tp, NULL);
> return Tp.tv_sec + (Tp.tv_usec /10000000.);
> }
> ----------------------------schnapp >8------------------------------
>
> At home I wanted to finish the program using Dev-C++ (current
> beta with
> fixed exe), but the compiler refused work when compiling this function
> with the message
>
> ----------------------------8< schnipp------------------------------
> aggregate `struct timeval Tp' has incomplete type and cannot be
> initialized
> ----------------------------schnapp >8------------------------------
>
> But in university (under Linux) it does work....so is this a
> problem of
> the compiler (gcc versions differ in university and at home) or a
> platform problem (Linux specific parts)? Sorry, I am no
> expert, just had
> two weeks of this course and I am only used to basic (under DOS).
For portable code use the functions provided in time.h . There is much
useful stuff in there.
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.cjb.net
* Alternative URL: http://run.to/noicys
|