Menu

#547 Sleep throws error with non zero decimal fraction

CoreUtils
open
GnuWin
Binaries (396)
5
2014-12-21
2011-12-13
Anonymous
No

On Win2008R2 sleep throws error in some cases:

C:>C:\gnuwin32\bin\sleep.exe 1

C:>C:\gnuwin32\bin\sleep.exe 1.0

C:>C:\gnuwin32\bin\sleep.exe 0.5
C:\gnuwin32\bin\sleep.exe: cannot read realtime clock: Invalid argument

C:>C:\gnuwin32\bin\sleep.exe 1.5
C:\gnuwin32\bin\sleep.exe: cannot read realtime clock: Invalid argument

C:>C:\gnuwin32\bin\sleep.exe 1.1
C:\gnuwin32\bin\sleep.exe: cannot read realtime clock: Invalid argument

C:>C:\gnuwin32\bin\sleep.exe 1.0

C:>

Discussion

  • Anonymous

    Anonymous - 2012-12-09

    I've found it only works under Windows when the fraction evaluates to an integral number of seconds:

    C:\>gdate & sleep .1m & gdate
    Sat Dec  8 16:05:40 Pacific Standard Time 2012
    Sat Dec  8 16:05:46 Pacific Standard Time 2012
    
    C:\>gdate & sleep .05m & gdate
    Sat Dec  8 16:06:04 Pacific Standard Time 2012
    Sat Dec  8 16:06:07 Pacific Standard Time 2012
    
    C:\>gdate & sleep .025m & gdate
    Sat Dec  8 16:06:13 Pacific Standard Time 2012
    sleep: cannot read realtime clock: Invalid argument
    Sat Dec  8 16:06:13 Pacific Standard Time 2012
    
    C:\>gdate & sleep .033333333333m & gdate
    Sat Dec  8 16:06:26 Pacific Standard Time 2012
    Sat Dec  8 16:06:28 Pacific Standard Time 2012
    
    C:\>gdate & sleep .016666666666m & gdate
    Sat Dec  8 16:06:45 Pacific Standard Time 2012
    Sat Dec  8 16:06:46 Pacific Standard Time 2012
    
     

    Last edit: Anonymous 2018-10-12