This file had CR/LF line endings for some reason.

This commit is contained in:
Rene Gollent
2011-12-11 19:31:17 -05:00
parent fe10dd20bf
commit 1394478206
+71 -71
View File
@@ -1,71 +1,71 @@
#include <BeOSBuildCompatibility.h> #include <BeOSBuildCompatibility.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/time.h> #include <sys/time.h>
#include <Debug.h> #include <Debug.h>
#include <image.h> #include <image.h>
#include <OS.h> #include <OS.h>
mode_t __gUmask = 022; mode_t __gUmask = 022;
// debugger // debugger
void void
debugger(const char *message) debugger(const char *message)
{ {
fprintf(stderr, "debugger() called: %s\n", message); fprintf(stderr, "debugger() called: %s\n", message);
exit(1); exit(1);
} }
// _debuggerAssert // _debuggerAssert
int int
_debuggerAssert(const char *file, int line, char *expression) _debuggerAssert(const char *file, int line, char *expression)
{ {
char buffer[2048]; char buffer[2048];
snprintf(buffer, sizeof(buffer), "%s:%d: %s\n", file, line, expression); snprintf(buffer, sizeof(buffer), "%s:%d: %s\n", file, line, expression);
debugger(buffer); debugger(buffer);
return 0; return 0;
} }
// system_time // system_time
bigtime_t bigtime_t
system_time(void) system_time(void)
{ {
struct timeval tm; struct timeval tm;
gettimeofday(&tm, NULL); gettimeofday(&tm, NULL);
return (int64)tm.tv_sec * 1000000LL + (int64)tm.tv_usec; return (int64)tm.tv_sec * 1000000LL + (int64)tm.tv_usec;
} }
// snooze // snooze
status_t status_t
snooze(bigtime_t amount) snooze(bigtime_t amount)
{ {
if (amount <= 0) if (amount <= 0)
return B_OK; return B_OK;
int64 secs = amount / 1000000LL; int64 secs = amount / 1000000LL;
int64 usecs = amount % 1000000LL; int64 usecs = amount % 1000000LL;
if (secs > 0) { if (secs > 0) {
if (sleep((unsigned)secs) < 0) if (sleep((unsigned)secs) < 0)
return errno; return errno;
} }
if (usecs > 0) { if (usecs > 0) {
if (usleep((useconds_t)usecs) < 0) if (usleep((useconds_t)usecs) < 0)
return errno; return errno;
} }
return B_OK; return B_OK;
} }
// snooze_until // snooze_until
status_t status_t
snooze_until(bigtime_t time, int timeBase) snooze_until(bigtime_t time, int timeBase)
{ {
return snooze(time - system_time()); return snooze(time - system_time());
} }