Page 1 of 1
adsgetservertime
Posted: Wed Feb 18, 2009 7:38 pm
by hugotheler
Hola Gente :
Necesitaria saber la hora del server , encontre la funcion ADSSETSERVERTIME pero al usarla me tira error.
En otros mail lei que se usaba ADSSETSERVERTIME()[2] , pero no me funciona .
ERROR 5018 : The handle given was not recognized by advantage. Verify specified handle is open/active. The given handle is not readable.
xharbour 0.99.3
FiveWin
ADS 8.0
Windows 2003 server.
Gracias
Re: adsgetservertime
Posted: Wed Feb 18, 2009 8:22 pm
by Patricio Avalos Aguirre
Hola
AdsGetServerTime() solo funciona con un servidor de ADS remoto, no funcion en modo local
ahora si tienes un servidor Remoto con Ads te dejo dos funciones que pueden ayudarte
Code: Select all
function DateAds()
local dFecha, aFec
if ViewUsu():AdsConnect > 1 .and. Valtype( aFec:=AdsGetServerTime() ) = "A" // si la conecion no es local
dFecha := ctod(aFec[1])
if !empty( dFecha )
return( dFecha )
endif
endif
return( date() )
//--------------------------------------------------------------------------------------------------------
//retorna la hora del servidor ads
function TimeAds()
local cHor, cMer, cMin, cSec, cAds, aTime
if ViewUsu():AdsConnect > 1 .and. Valtype( aTime:=AdsGetServerTime() ) = "A" // si la conecion no es local
cAds := aTime[2]
cHor := left( cAds, 2)
cMer := Upper( Right(cAds, 2) )
do case
case cMer='PM' .and. !cHor=='12'
cHor := padl( Val(cHor)+12, 2, '0' )
case cMer='AM' .and. cHor=='12'
cHor := '00'
endcase
cMin := SubStr(cAds, 4, 2)
cSec := SubStr(cAds, 7, 2)
return( cHor +":"+cMin +":"+ cSec )
endif
return( time() )
//--------------------------------------------------------------------------------------------------------
Re: adsgetservertime
Posted: Mon Feb 23, 2009 8:33 pm
by hugotheler
Gracias.