version 1.1.1.1, 2013/10/14 07:51:14
|
version 1.1.1.2, 2016/11/01 09:54:32
|
Line 4
|
Line 4
|
* Copyright (C) 1996-2000 Andrew Tridgell |
* Copyright (C) 1996-2000 Andrew Tridgell |
* Copyright (C) 1996 Paul Mackerras |
* Copyright (C) 1996 Paul Mackerras |
* Copyright (C) 2001, 2002 Martin Pool <mbp@samba.org> |
* Copyright (C) 2001, 2002 Martin Pool <mbp@samba.org> |
* Copyright (C) 2003-2013 Wayne Davison | * Copyright (C) 2003-2015 Wayne Davison |
* |
* |
* This program is free software; you can redistribute it and/or modify |
* This program is free software; you can redistribute it and/or modify |
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
Line 35 extern int checksum_len;
|
Line 35 extern int checksum_len;
|
**/ |
**/ |
int msleep(int t) |
int msleep(int t) |
{ |
{ |
|
#ifdef HAVE_USLEEP |
|
usleep(t*1000); |
|
#else |
int tdiff = 0; |
int tdiff = 0; |
struct timeval tval, t1, t2; |
struct timeval tval, t1, t2; |
|
|
Line 48 int msleep(int t)
|
Line 51 int msleep(int t)
|
select(0,NULL,NULL, NULL, &tval); |
select(0,NULL,NULL, NULL, &tval); |
|
|
gettimeofday(&t2, NULL); |
gettimeofday(&t2, NULL); |
if (t2.tv_sec < t1.tv_sec) |
|
t1 = t2; /* Time went backwards, so start over. */ |
|
tdiff = (t2.tv_sec - t1.tv_sec)*1000 + |
tdiff = (t2.tv_sec - t1.tv_sec)*1000 + |
(t2.tv_usec - t1.tv_usec)/1000; |
(t2.tv_usec - t1.tv_usec)/1000; |
|
if (tdiff < 0) |
|
t1 = t2; /* Time went backwards, so start over. */ |
} |
} |
|
#endif |
|
|
return True; |
return True; |
} |
} |