Re: [chrony-dev] [PATCH] Fix rounding in UTI_DoubleToTimeval() |
[ Thread Index |
Date Index
| More chrony.tuxfamily.org/chrony-dev Archives
]
- To: chrony-dev@xxxxxxxxxxxxxxxxxxxx
- Subject: Re: [chrony-dev] [PATCH] Fix rounding in UTI_DoubleToTimeval()
- From: Bryan Christianson <bryan@xxxxxxxxxxxxx>
- Date: Fri, 24 Jul 2015 04:24:06 +1200
- Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=smtpcorp.com; s=a0-2; h=Feedback-ID:X-Smtpcorp-Track:To:Message-Id:Date: From:Subject; bh=B0M6vI3AArpC8tjU88b0I/WAJev4XQQRDZjqGJGcFwk=; b=NGoGWLOGbeoQ XQQfpm2xX3BrpO/cUlasGU6C9u6JbC5454NxPYPqRCXsmtoKbAG+MpXtizMnnkdV4++cDQKTZwPmz aZD8+KuvF/qpOGbgbWqD+FtOBsiPK9XaxPdFB2WDNnPfq0WwPsJK1twtNpXMQHXh24cLBPRrLr7lW 76j2mqUSUOZtLbnwbqMDbixppUH463zrATPGyjbg22hV0041N2cxDzxH+dgzblppqCT7UA/Lmvlbf 0rusXhOicg8wufvokDis9H6bkCNNdY7uvZhAgdF4IcmyanmmI1t9I88qIvT5Fe5dmB551KVNioU0m 9GBNiUHC8nu4jQGsvoOLkA==;
- Feedback-id: 149811m:149811acx33YQ:149811sghliHTmUl:SMTPCORP
> On 24/07/2015, at 12:34 am, Miroslav Lichvar <mlichvar@xxxxxxxxxx> wrote:
>
> On Fri, Jul 24, 2015 at 12:05:20AM +1200, Bryan Christianson wrote:
>>> On 23/07/2015, at 11:59 pm, Miroslav Lichvar <mlichvar@xxxxxxxxxx> wrote:
>>> Does Mac OS X have 32-bit time_t and 64-bit long? Or it's the other
>>> way around?
>>
>> 64 bit long, 32 bit time_t.
>
> That's an unusual combination. I've seen time_t longer than long, but
> not shorter. I hope they know about year 2038 :).
from the headers
#ifndef _STRUCT_TIMEVAL
#define _STRUCT_TIMEVAL struct timeval
_STRUCT_TIMEVAL
{
__darwin_time_t tv_sec; /* seconds */
__darwin_suseconds_t tv_usec; /* and microseconds */
};
#endif /* _STRUCT_TIMEVAL */
and then
typedef long __darwin_time_t; /* time() */
typedef __int32_t __darwin_suseconds_t; /* [???] microseconds */
So there is no 2038 issue and 1.0e6 microseconds will always fit into an int32. Weird that the struct timeval is no longer symmetrical tho. I hadn't actually noticed that before.
Casting tv_usec values to int will work on a Mac and suppress the warnings. Does any supported OS have int < 32 bits ?
Bryan
--
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble? Email listmaster@xxxxxxxxxxxxxxxxxxxx.