gcc 4.7.2
c89
APR 1.4
Hello,
I am compiling my program in 32 bit mode i.e. -m32
as some of the libraries I am linking with use 32 bit libraries.
I have the following structure:
struct tag_channel {
apr_int32_t id;
char *name;
};
For the id I want to have a random number so I am using the APR:
apr_time_t time_secs = apr_time_sec(apr_time_now());
I am wondering about casting because apr_time_sec returns an apr_time_t type which is:
typedef apr_int64_t
I could cast into the following:
channel->id = (apr_int32_t)time_secs;
However, I am worried about the loss of value by casting down.
The following is 64bit, so not sure if this would work.
#define APR_TIME_T_FMT APR_INT64_T_FMT
I don't want to change the channel structure for the id to apr_time_t
as it doesn't really make sense to have time value for an ID value.
Which is the best way to cast this?
Many thanks for any suggestions,