Skip to content

Commit 8eb86b5

Browse files
committed
Add SLEEP_MS to sleep for milliseconds
Replace current SLEEP macro with SLEEP_MS. Replace existing SLEEP macro with version that sleeps for seconds.
1 parent 246c249 commit 8eb86b5

File tree

5 files changed

+16
-14
lines changed

5 files changed

+16
-14
lines changed

plc/Transmit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ signed Transmit (struct plc * plc, byte source [], byte target [])
9393
{
9494
error (1, errno, CANT_RESET_TIMER);
9595
}
96-
SLEEP (100);
96+
SLEEP_MS (100);
9797
}
9898
return (0);
9999
}

serial/ptsctl.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ static void function1 (struct _file_ * port, char const * units, unsigned wait,
196196
{
197197
error (1, errno, FILE_CANTSAVE, port->name);
198198
}
199-
SLEEP (wait);
199+
SLEEP_MS (wait);
200200
}
201201
return;
202202
}
@@ -234,7 +234,7 @@ static void function2 (struct _file_ * port, char const * units, unsigned wait,
234234
{
235235
error (1, errno, FILE_CANTSAVE, port->name);
236236
}
237-
SLEEP (wait);
237+
SLEEP_MS (wait);
238238
}
239239
return;
240240
}
@@ -265,14 +265,14 @@ static void function3 (struct _file_ * port, char const * units, unsigned wait)
265265
{
266266
error (1, errno, FILE_CANTSAVE, port->name);
267267
}
268-
SLEEP (wait);
268+
SLEEP_MS (wait);
269269
memset (buffer, 0, sizeof (buffer));
270270
if (read (port->file, buffer, PTSCTL_LEDS + 2) == -1)
271271
{
272272
error (1, errno, FILE_CANTREAD, port->name);
273273
}
274274
memcpy (&string [offset], &buffer [1], PTSCTL_LEDS);
275-
SLEEP (wait);
275+
SLEEP_MS (wait);
276276
}
277277
cycle (string, PTSCTL_LEDS, 2);
278278
while (--offset > PTSCTL_BITS)
@@ -310,7 +310,7 @@ static void function4 (struct _file_ * port, char const * units, unsigned wait)
310310
{
311311
function2 (port, units, wait, (value << 8) | (value << 1) | 1);
312312
function3 (port, units, wait);
313-
SLEEP (wait);
313+
SLEEP_MS (wait);
314314
}
315315
return;
316316
}

serial/weeder.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ static void function1 (struct _file_ * port, char const * units, unsigned wait,
170170
{
171171
error (1, errno, FILE_CANTSAVE, port->name);
172172
}
173-
SLEEP (wait);
173+
SLEEP_MS (wait);
174174
}
175175
return;
176176
}
@@ -205,7 +205,7 @@ static void function2 (struct _file_ * port, char const * units, unsigned wait,
205205
{
206206
error (1, errno, FILE_CANTSAVE, port->name);
207207
}
208-
SLEEP (wait);
208+
SLEEP_MS (wait);
209209
length = 0;
210210
buffer [length++] = *units++;
211211
buffer [length++] = 'W';
@@ -219,7 +219,7 @@ static void function2 (struct _file_ * port, char const * units, unsigned wait,
219219
{
220220
error (1, errno, FILE_CANTSAVE, port->name);
221221
}
222-
SLEEP (wait);
222+
SLEEP_MS (wait);
223223
return;
224224
}
225225

@@ -248,13 +248,13 @@ static void function3 (struct _file_ * port, char const * units, unsigned wait)
248248
{
249249
error (1, errno, FILE_CANTSAVE, port->name);
250250
}
251-
SLEEP (wait);
251+
SLEEP_MS (wait);
252252
memset (buffer, 0, sizeof (buffer));
253253
if (read (port->file, buffer, WEEDER_LEDS + 2) == -1)
254254
{
255255
error (1, errno, FILE_CANTREAD, port->name);
256256
}
257-
SLEEP (wait);
257+
SLEEP_MS (wait);
258258
memcpy (&string [offset], &buffer [1], WEEDER_LEDS);
259259
}
260260
while (offset-- > 3)

slac/pev_cm_mnbc_sound.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ signed pev_cm_mnbc_sound (struct session * session, struct channel * channel, st
8888
{
8989
return (slac_debug (session, 1, __func__, CHANNEL_CANTSEND));
9090
}
91-
SLEEP (session->pause);
91+
SLEEP_MS (session->pause);
9292
}
9393
return (0);
9494
}

tools/timer.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@
2525
*--------------------------------------------------------------------*/
2626

2727
#ifdef WIN32
28-
#define SLEEP(n) Sleep(n)
28+
#define SLEEP(n) Sleep((n) * 1000)
29+
#define SLEEP_MS(n) Sleep((n))
2930
#else
30-
#define SLEEP(n) usleep((n)*1000)
31+
#define SLEEP(n) sleep((n))
32+
#define SLEEP_MS(n) usleep((n) * 1000)
3133
#endif
3234

3335
/*====================================================================*

0 commit comments

Comments
 (0)