FUNCTION GetSvrSysDateTime( cServer, lSync ) LOCAL dDate,cTime, nStart, nEnd, cString, nLen LOCAL cSetDate, cCommand LOCAL cRet := "", cFile := FileName( "LIXO" ) DEFAULT cServer TO "\\Server02" DEFAULT lSync TO .F. // Sincronizar estacao X servidor (Tratar depois) altd() IF ! Empty( cFile ) /* cCommand := "CMD /C START " + ; "" + ; "/D" + DirName() + " " + ; "/MIN /WAIT " + ; "NET TIME " + ; cServer + " > " + cFile */ //RUN ( "Net Time " + cServer + " > " + cFile ) //cCommand := "NET TIME " + cServer + " > " + cFile cCommand := "VESERVER.BAT" RUN ( cCommand ) IF File("DataHora.txt") ///"( cFile ) cString := Memoread("DataHora.txt") //( cFile ) IF ( ! Empty( cString ) ) nLen := AT( "/", cString ) IF nLen > 0 cSetDate := Set( _SET_DATEFORMAT, "mm/dd/yyyy" ) While Substr( cString, nLen, 1 ) != " " nLen-- Enddo nStart := nLen + 1 cString := Substr( cString, nStart, Len( cString ) ) nEnd := AT( " ", cString ) dDate := Ctod( Substr( cString, 1, nEnd - 1 ) ) cString := Substr( cString, nEnd + 1, Len( cString ) ) nEnd := AT( " ", cString ) cTime := Substr( cString, 1, nEnd - 1 ) cString := Substr( cString, nEnd + 1, Len( cString ) ) nEnd := AT( ":", cTime ) If nEnd == 2 cTime := StrZero( Val( Left( cTime, 1 ) ), 2 ) + ":" + Substr( cTime, nEnd + 1, 2 ) Endif IF ( At( "PM", cString ) > 0 ) .And. Left( cTime, 2 ) != "12" cTime := StrZero( Val( Left( cTime, 2 ) ) + 12, 2 ) + Substr( cTime, 3, 3 ) ELSEIF ( At( " AM", cString ) > 0 ) .And. Left( cTime, 2 ) == "12" cTime := "00" + Right( cTime, 3 ) ENDIF ELSE dDate := CtoD( "" ) cTime := " : " ENDIF FileErase( cFile ) ENDIF ENDIF Set( _SET_DATEFORMAT, cSetDate ) cRet := DtoC( dDate ) + " " + cTime ENDIF RETURN cRet //------------------------------------------------------------------------------