From 4185b2524b06d93f46173b480fb1ef9f5a029595 Mon Sep 17 00:00:00 2001 From: rfm Date: Mon, 24 Apr 2006 15:43:21 +0000 Subject: [PATCH] Avoid minor rounding errors. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22807 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 27 ++++++++++++++++----------- Source/NSCalendarDate.m | 4 ++-- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6ebb039e5..c70b39f01 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-04-24 Richard Frith-Macdonald + + * Source/NSCalendarDate.m: Avoid a couple of minor rounding errors + by using floating point constants for millisecond multipliers. + 2006-04-24 Alex Perez * Source/NSProcessInfo.m: Elaborated upon the @@ -12,28 +17,28 @@ 2006-04-14 Jeremy Bettis * Source/win32/GSFileHandleWin32.m: Fix background reading of pipes. - Several changes for Openstep compatiblity: Don't queue notification, - don't raise exception when asked to read while a background operation - is in progress. + Several changes for Openstep compatiblity: Don't queue notification, + don't raise exception when asked to read while a background operation + is in progress. * Source/win32/GSRunLoopCtxt.m: If there are no handles to block on - but there is a timer, sleep until the timer needs to wake up. + but there is a timer, sleep until the timer needs to wake up. 2006-04-12 Jeremy Bettis * Source/NSTimeZone.m: Use native time zone files under Solaris. * Source/GSFFCallInvocation.m: If the returning context is expecting - a void* but we have a different return type just cast it. This - normally is because the method was not declared and has defaulted - to returning id. + a void* but we have a different return type just cast it. This + normally is because the method was not declared and has defaulted + to returning id. * Source/win32/NSUserDefaultsWin32.m: Write defaults to registry as - unicode strings, read in either unicode(REG_SZ) or ascii(REG_BINARY). + unicode strings, read in either unicode(REG_SZ) or ascii(REG_BINARY). * Source/win32-load.h: In mingw, fileSystemRepresentation is unicode * Source/objc-load.m: In mingw, fileSystemRepresentation is unicode * Source/NSPropertyList.m (propertyListFromData:mutabilityOption:format:errorDescription:): - Don't call memcmp if the data is smaller than 8 bytes. + Don't call memcmp if the data is smaller than 8 bytes. * Source/NSFileManager.m (isExecutableFileAtPath:): - Added a comment + Added a comment * Source/NSBundle.m (objc_executable_location): - A cast was obsuring a misuse of fileSystemRepresentation + A cast was obsuring a misuse of fileSystemRepresentation 2006-04-10 Fred Kiefer diff --git a/Source/NSCalendarDate.m b/Source/NSCalendarDate.m index 5abf2b5b1..02fed1159 100644 --- a/Source/NSCalendarDate.m +++ b/Source/NSCalendarDate.m @@ -268,7 +268,7 @@ GSBreakTime(NSTimeInterval when, int *year, int *month, int *day, m = m * 60; c = a - h - m; *second = (int)c; - *mil = (a - h - m - c) * 1000; + *mil = (int)((a - h - m - c) * 1000.0); } /** @@ -1897,7 +1897,7 @@ static void Grow(DescriptionInfo *info, unsigned size) s -= (_seconds_since_ref + offset(_time_zone, self)); s = fabs(s); s -= floor(s); - v = (int)(s * 1000); + v = (int)(s * 1000.0); } Grow(info, 3); info->t[info->offset+2] = (v%10) + '0';