sizeof(struct timeval)

Big and Blue No_4 at dsl.pipex.com
Tue Mar 14 02:43:45 CET 2006


Big and Blue wrote:
 > Tony Houghton wrote:
 >>
 >> How safe would I be assuming that
 >>     sizeof(struct timeval) == 2 * sizeof(long)
 >>
 >> is always true on Linux on different architectures?
 >
 >    Based on what I was looking at today (well, yesterday now), you might
 > be wrong.

    However, it looks as though I was wrong:

linux/time.h:
  struct timeval {
          time_t          tv_sec;         /* seconds */
          suseconds_t     tv_usec;        /* microseconds */
  };

time.h:
  typedef __time_t time_t;

sys/time.h:
  typedef __suseconds_t suseconds_t;

bits/types.h:
  __STD_TYPE __TIME_T_TYPE __time_t;      /* Seconds since the Epoch.  */
  ...
  __STD_TYPE __SUSECONDS_T_TYPE __suseconds_t; /* Signed count of microseconds */


bits/typesizes.h:
  #define __TIME_T_TYPE           __SLONGWORD_TYPE
  ...
  #define __SUSECONDS_T_TYPE      __SLONGWORD_TYPE

bits/types.h:
  #define __SLONGWORD_TYPE        long int



-- 
              Just because I've written it doesn't mean that
                   either you or I have to believe it.



More information about the Python-list mailing list