adsgetservertime

Post Reply
hugotheler
Posts: 15
Joined: Wed Sep 05, 2007 7:32 pm

adsgetservertime

Post 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
User avatar
Patricio Avalos Aguirre
Posts: 1028
Joined: Fri Oct 07, 2005 1:56 pm
Location: La Serena, Chile
Contact:

Re: adsgetservertime

Post 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() )
//--------------------------------------------------------------------------------------------------------
 
Saludos
Patricio

__________________________________________________________________
Version: Harbour 3.2.0dev (r1307082134),Compiler: Borland C++ 5.8.2 (32-bit)
PCode version: 0.3, FWH 13.2
http://www.sialm.cl
hugotheler
Posts: 15
Joined: Wed Sep 05, 2007 7:32 pm

Re: adsgetservertime

Post by hugotheler »

Gracias.
Post Reply