FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour SysWait() problem. - SOLVED
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
SysWait() problem. - SOLVED
Posted: Sat Mar 01, 2025 09:50 AM
Hi,

I looked for the source code of the SysWait function in the Fwh source codes directory, but I could not find it. I guess it could be in the harbour. I found a source code shared by Enrico in an old topic on this forum. Is this code the code we use in our applications?
function SysWait( nLong )

   local nSeconds

   DEFAULT nLong := .1
   nSeconds := Seconds() + nLong

   while Seconds() < nSeconds
     SysRefresh()
   end

return .t.
If yes, I think there is a problem here. When the time changes from 23.59 to the next day, the function enters an infinite loop and crashes the application. Has anyone had this problem? How can we solve it?
Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: SysWait() problem.
Posted: Sat Mar 01, 2025 10:33 AM
Dear Hakan,

This updated version should solve it:
function SysWait( nLong )
   local nStart

   DEFAULT nLong := .1
   nStart := HB_MilliSeconds()  // Milliseconds since app start or system epoch

   while (HB_MilliSeconds() - nStart) < (nLong * 1000)  // Convert seconds to milliseconds
      SysRefresh()
   end

return .T.
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
Re: SysWait() problem.
Posted: Sun Mar 02, 2025 09:01 AM
Antonio Linares wrote: Dear Hakan,

This updated version should solve it:
function SysWait( nLong )
   local nStart

   DEFAULT nLong := .1
   nStart := HB_MilliSeconds()  // Milliseconds since app start or system epoch

   while (HB_MilliSeconds() - nStart) < (nLong * 1000)  // Convert seconds to milliseconds
      SysRefresh()
   end

return .T.
Thank you Antonio,

I will try it and write the result.
Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
Re: SysWait() problem.
Posted: Mon Mar 03, 2025 06:06 AM

Thank you Antonio,

It works just fine.

Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06

Continue the discussion