mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-01 09:02:01 +00:00
millisecond counts should round down (0-999).
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@36751 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e8c56a5d9d
commit
4ab22b8130
2 changed files with 31 additions and 27 deletions
|
@ -277,7 +277,7 @@ GSBreakTime(NSTimeInterval when, int *year, int *month, int *day,
|
|||
m = m * 60;
|
||||
c = a - h - m;
|
||||
*second = (NSInteger)c;
|
||||
*mil = (NSInteger)((a - h - m - c) * 1000.0 + 0.5);
|
||||
*mil = (NSInteger)((a - h - m - c) * 1000.0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -190,8 +190,9 @@ _NSLog_standard_printf_handler (NSString* message)
|
|||
if (GSPrivateDefaultsFlag(GSLogSyslog) == YES
|
||||
|| write(_NSLogDescriptor, buf, len) != (int)len)
|
||||
{
|
||||
// QNX's slog has a size limit per entry. We might need to iterate over
|
||||
// _SLOG_MAXSIZEd chunks of the buffer
|
||||
/* QNX's slog has a size limit per entry. We might need to iterate over
|
||||
* _SLOG_MAXSIZEd chunks of the buffer
|
||||
*/
|
||||
const char *newBuf = buf;
|
||||
unsigned newLen = len;
|
||||
|
||||
|
@ -202,17 +203,20 @@ _NSLog_standard_printf_handler (NSString* message)
|
|||
{
|
||||
strncpy(null_terminated_buf, newBuf, (_SLOG_MAXSIZE - 1));
|
||||
null_terminated_buf[_SLOG_MAXSIZE] = '\0';
|
||||
slogf(_SLOG_SETCODE(_SLOG_SYSLOG, 0), _SLOG_ERROR, "%s", null_terminated_buf);
|
||||
slogf(_SLOG_SETCODE(_SLOG_SYSLOG, 0), _SLOG_ERROR, "%s",
|
||||
null_terminated_buf);
|
||||
newBuf += (_SLOG_MAXSIZE - 1);
|
||||
newLen -= (_SLOG_MAXSIZE - 1);
|
||||
}
|
||||
// Write out the rest (which will be at most (_SLOG_MAXSIZE - 1) chars, so
|
||||
// the terminator still fits.
|
||||
/* Write out the rest (which will be at most (_SLOG_MAXSIZE - 1) chars,
|
||||
* so the terminator still fits.
|
||||
*/
|
||||
if (0 != newLen)
|
||||
{
|
||||
strncpy(null_terminated_buf, newBuf, newLen);
|
||||
null_terminated_buf[newLen] = '\0';
|
||||
slogf(_SLOG_SETCODE(_SLOG_SYSLOG, 0), _SLOG_ERROR, "%s", null_terminated_buf);
|
||||
slogf(_SLOG_SETCODE(_SLOG_SYSLOG, 0), _SLOG_ERROR, "%s",
|
||||
null_terminated_buf);
|
||||
}
|
||||
free(null_terminated_buf);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue