Date from Internet

Date from Internet

Postby Silvio.Falconi » Sat Mar 28, 2015 11:03 am

Exist a function to load date from Internet ?

I ask this because I protected my app with sysdate but the user can easy change the sys date and lunch the app

If I have the date od Internet I can change the sysdate od pc ...and then my app


On forum I tried this source of Antonio Linares

Code: Select all  Expand view
// Internet time

#include "FiveWin.ch"

function Main()

   MsgInfo( GetNtpDate( "204.123.2.72" ) )

return nil

#pragma BEGINDUMP

#include <hbapi.h>
#include <winsock.h>
#include <time.h>

#define MAXLEN 1024

HB_FUNC( GETNTPDATE )
{
   char * hostname = ( char * ) hb_parc( 1 );
   unsigned char msg[ 48 ] = { 010, 0, 0, 0, 0, 0, 0, 0, 0 };   // the packet we send
   unsigned long buf[ MAXLEN ]; // the buffer we get back
   struct sockaddr_in server_addr;
   int  s;  // socket
   WSADATA wsa;
   struct timeval timeout;
   fd_set fds;
   time_t tmit;
         
   WSAStartup( 0x101, &wsa );    

   s = socket( PF_INET, SOCK_DGRAM, getprotobyname( "udp" )->p_proto );

   memset( &server_addr, 0, sizeof( server_addr ) );
   server_addr.sin_family = AF_INET;
   server_addr.sin_addr.s_addr = inet_addr( hostname );
   server_addr.sin_port = htons( 123 ); // ntp port
   
   sendto( s, msg, sizeof( msg ), 0, ( struct sockaddr * ) &server_addr, sizeof( server_addr ) );
   
   FD_ZERO( &fds );
   FD_SET( s, &fds );
   timeout.tv_sec = 10;
   timeout.tv_usec = 0;
     
   if( select( 0, &fds, NULL, NULL, &timeout ) )
   {      
      recv( s, ( void * ) buf, sizeof( buf ), 0 );

      tmit = ntohl( buf[ 10 ] );
      tmit-= 2208988800U;
   }  
   else
      MessageBox( 0, "can't read from NTP server", "ok", 0 );      
   
   WSACleanup();

   hb_retc( ctime( &tmit ) );
}

#pragma ENDDUMP


 




but it return allways can't read from NTP server any solution ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6834
Joined: Thu Oct 18, 2012 7:17 pm

Re: Date from Internet

Postby anserkk » Sat Mar 28, 2015 11:59 am

Please try the below given code.

Code: Select all  Expand view
*------------------------------------------*
Function GetDateTimeFromNTP()
*------------------------------------------*
/* This function would return the Real date and time from an internet date time server via NTP.
   If successful, Returns an array containing 3 elements ie GMT DateTime, Indian Standarrd Date Time, PC's Date Time
   If not successful then returns an empty array.
   
   This function depends on the the other 3 functions like hb_ntp_GetTimeUTC(),ntohl(),Bin2U()
   All these functions are available in the Harbour lib HbMisc.
   Unfortunately, the day that we made this function ie 29-Apr-2014, these functions were not included in the HbMisc supplied along
   with FWH. So next time when we get an updated Harbour ver with FWH, we can eliminate the functions
   hb_ntp_GetTimeUTC(),ntohl(),Bin2U() from this PRG. Till then it is required
*/
   
   LOCAL tGmtDateTime,tPcDateTime,aDateTime:={}


   TRY
     tGmtDateTime := hb_ntp_GetTimeUTC( "0.europe.pool.ntp.org" )
   CATCH
     Return aDateTime:={}
   END
   tPcDateTime:=hb_DateTime()

   aAdd(aDateTime,tGmtDateTime)  // UTC ie GMT Date Time
   aAdd(aDateTime,tGmtDateTime + hb_UTCOffset() / 86400)  // Converted to IST
   aAdd(aDateTime,tPcDateTime)  // The date time in PC
*   xbrowser aDateTime
   
/*  
   MsgInfo("UTC Time   : "+Ttoc(tTime)+CRLF+;
           "Local Time : "+Ttoc(tTime + hb_UTCOffset() / 86400) +CRLF+;   //86400
           "Sytem Time : "+Ttoc(hb_DateTime() ) )
*/
 
RETURN aDateTime
   
*-------------------------------------------------------*
FUNCTION hb_ntp_GetTimeUTC( cServer, nPort, nTimeOut )
*-------------------------------------------------------*
   LOCAL tTime := hb_SToT( "" )
   LOCAL hSocket, cBuffer
   DEFAULT nPort:=123
   DEFAULT nTimeOut:=10000 // 10seconds

   IF HB_ISSTRING( cServer ) .AND. ! Empty( cServer ) .AND. ;
      ! Empty( hSocket := hb_socketOpen( , HB_SOCKET_PT_DGRAM ) )
      cBuffer := hb_BChar( 8 ) + Replicate( hb_BChar( 0 ), 47 )
      IF hb_socketSendTo( hSocket, cBuffer,,, { HB_SOCKET_AF_INET, hb_socketResolveAddr( cServer ),  nPort  } ) == hb_BLen( cBuffer )
         cBuffer := Space( 12 * 4 )
         IF hb_socketRecvFrom( hSocket, @cBuffer,,,,  nTimeOut   ) == hb_BLen( cBuffer )
            tTime := hb_SToT( "19000101" ) + ;
               Bin2U( ntohl( hb_BSubStr( cBuffer, 10 * 4 + 1, 4 ) ) ) / 86400 + ;
               ( Bin2U( ntohl( hb_BSubStr( cBuffer, 11 * 4 + 1, 4 ) ) ) / ( 2 ^ 32 ) ) / 86400
         ENDIF
      ENDIF
      hb_socketClose( hSocket )
   ENDIF

   RETURN tTime

*---------------------------*  
STATIC FUNCTION ntohl( c )
*---------------------------*  
   IF hb_Version( HB_VERSION_ENDIANNESS ) == HB_VERSION_ENDIAN_LITTLE
      RETURN ;
         hb_BSubStr( c, 4, 1 ) + ;
         hb_BSubStr( c, 3, 1 ) + ;
         hb_BSubStr( c, 2, 1 ) + ;
         hb_BSubStr( c, 1, 1 )
   ENDIF

   RETURN c

*---------------------------*      
STATIC FUNCTION Bin2U( c )
*---------------------------*  
   LOCAL l := Bin2L( c )

   RETURN iif( l < 0, l + ( 2 ^ 32 ), l )  


Regards
Anser
User avatar
anserkk
 
Posts: 1331
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Date from Internet

Postby Silvio.Falconi » Sat Mar 28, 2015 6:28 pm

give me errors


on xharbour

Code: Select all  Expand view
Progetto: test, Ambiente: xFive_Pelles:
[1]:Harbour.Exe test.prg  /m /n0 /gc1 /w0 /es2 /iC:\Work\fwh\include /ic:\work\xHarbour\Include /jC:\Work\Prg\SOFTWA~1\INTERN~1\I18n\Main.hil /iinclude;c:\work\fwh\include;c:\work\xHarbour\include /oObj\test.c
xHarbour 1.2.3 Intl. (SimpLex) (Build 20140725)
Copyright 1999-2014, http://www.xharbour.org http://www.harbour-project.org/
Compiling 'test.prg'...
Generating international list to 'C:\Work\Prg\SOFTWA~1\INTERN~1\I18n\Main.hil'...
Generating C source output to 'Obj\test.c'...
Done.
Lines 81, Functions/Procedures 4, pCodes 258
[1]:Bcc32.Exe -M -c -O2  -tW -v- -X -DHB_FM_STATISTICS_OFF -DHB_NO_DEFAULT_API_MACROS -DHB_NO_DEFAULT_STACK_MACROS -DHB_OS_WIN_32 -IC:\Work\fwh\include -IC:\Work\bcc582\Include;c:\work\xHarbour\Include  -nC:\Work\Prg\SOFTWA~1\INTERN~1\Obj test.c
Borland C++ 5.82 for Win32 Copyright (c) 1993, 2005 Borland
test.c:
[1]:iLink32.Exe -Gn -aa -Tpe -s @test.bcl
Turbo Incremental Link 5.69 Copyright (c) 1997-2005 Borland
Error: Unresolved external '_HB_FUN_HB_DATETIME' referenced from C:\WORK\PRG\SOFTWARELOCK_OF_JEFF\INTERNETDATE\OBJ\TEST.OBJ
Error: Unresolved external '_HB_FUN_HB_UTCOFFSET' referenced from C:\WORK\PRG\SOFTWARELOCK_OF_JEFF\INTERNETDATE\OBJ\TEST.OBJ
Error: Unresolved external '_HB_FUN_HB_STOT' referenced from C:\WORK\PRG\SOFTWARELOCK_OF_JEFF\INTERNETDATE\OBJ\TEST.OBJ
Error: Unresolved external 'WSAIoctl' referenced from C:\WORK\XHARBOUR\LIB\RTL.LIB|hbsocket
Error: Unresolved external '_HB_FUN_HB_BCHAR' referenced from C:\WORK\PRG\SOFTWARELOCK_OF_JEFF\INTERNETDATE\OBJ\TEST.OBJ
Error: Unresolved external '_HB_FUN_HB_VERSION' referenced from C:\WORK\PRG\SOFTWARELOCK_OF_JEFF\INTERNETDATE\OBJ\TEST.OBJ
 



on Harbour

Code: Select all  Expand view
Progetto: test, Ambiente: Five_Pelles:
[1]:Harbour.Exe test.prg  /m /n0 /gc1 /es2 /iC:\Work\fwh\include /ic:\work\Harbour\Include /jitaliano.HIT /iinclude;c:\work\fwh\include;c:\work\Harbour\include /oObj\test.c
Harbour 3.2.0dev (r1406271520)
Copyright (c) 1999-2014, http://harbour-project.org/
Compiling 'test.prg'...
test.prg(17) Error E0020  Incomplete statement or unbalanced delimiters
test.prg(19) Error E0020  Incomplete statement or unbalanced delimiters
test.prg(21) Error E0030  Syntax error "syntax error at 'END'"
3 errors

No code generated.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6834
Joined: Thu Oct 18, 2012 7:17 pm

Re: Date from Internet

Postby anserkk » Mon Mar 30, 2015 4:45 am

Sorry, I forgot to mention about the required #include's

Please include
Code: Select all  Expand view
#include "hbsocket.ch"
#include "hbver.ch"



Code: Select all  Expand view
#include "hbsocket.ch"
#include "hbver.ch"
#Include "xbrowse.ch"

*------------------------------------------*
Function Main()
*------------------------------------------*

    xBrowser GetDateTimeFromNTP()
Return


In Harbour it is working fine here.

In xHarbour, for the Unresolved functions, you need to find/identify the equivalent functions in xHarbour

Code: Select all  Expand view
Unresolved external '_HB_FUN_HB_DATETIME'
Unresolved external '_HB_FUN_HB_UTCOFFSET'
Unresolved external '_HB_FUN_HB_STOT'
Unresolved external 'WSAIoctl'  
Unresolved external '_HB_FUN_HB_BCHAR'
Unresolved external '_HB_FUN_HB_VERSION'


Including #Include "hbcompat.ch" eliminates few unresolved functions.

Regards
Anser
User avatar
anserkk
 
Posts: 1331
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Date from Internet

Postby Silvio.Falconi » Mon Mar 30, 2015 9:34 am

Anserk
on xharbour Error
Code: Select all  Expand view
Progetto: test, Ambiente: xFive_Pelles:
[1]:Harbour.Exe test.prg  /m /n0 /gc1 /es2 /iC:\Work\fwh\include /ic:\work\xHarbour\Include /jC:\Work\Prg\SOFTWA~1\INTERN~1\I18n\Main.hil /iinclude;c:\work\fwh\include;c:\work\xHarbour\include /oObj\test.c
xHarbour 1.2.3 Intl. (SimpLex) (Build 20140725)
Copyright 1999-2014, http://www.xharbour.org http://www.harbour-project.org/
Compiling 'test.prg'...
Generating international list to 'C:\Work\Prg\SOFTWA~1\INTERN~1\I18n\Main.hil'...
Generating C source output to 'Obj\test.c'...
Done.
Lines 93, Functions/Procedures 5, pCodes 276
[1]:Bcc32.Exe -M -c -O2  -tW -v- -X -DHB_FM_STATISTICS_OFF -DHB_NO_DEFAULT_API_MACROS -DHB_NO_DEFAULT_STACK_MACROS -DHB_OS_WIN_32 -IC:\Work\fwh\include -IC:\Work\bcc582\Include;c:\work\xHarbour\Include  -nC:\Work\Prg\SOFTWA~1\INTERN~1\Obj test.c
Borland C++ 5.82 for Win32 Copyright (c) 1993, 2005 Borland
test.c:
[1]:iLink32.Exe -Gn -aa -Tpe -s @test.bcl
Turbo Incremental Link 5.69 Copyright (c) 1997-2005 Borland
Error: Unresolved external '_HB_FUN_HB_UTCOFFSET' referenced from C:\WORK\PRG\SOFTWARELOCK_OF_JEFF\INTERNETDATE\OBJ\TEST.OBJ
Error: Unresolved external 'WSAIoctl' referenced from C:\WORK\XHARBOUR\LIB\RTL.LIB|hbsocket
Error: Unresolved external '_HB_FUN_HB_BCHAR' referenced from C:\WORK\PRG\SOFTWARELOCK_OF_JEFF\INTERNETDATE\OBJ\TEST.OBJ
Error: Unresolved external '_HB_FUN_HB_VERSION' referenced from C:\WORK\PRG\SOFTWARELOCK_OF_JEFF\INTERNETDATE\OBJ\TEST.OBJ
 




on Harbour Error


Code: Select all  Expand view

Progetto: test, Ambiente: Five_Pelles:
[1]:Harbour.Exe test.prg  /m /n0 /gc1 /es2 /iC:\Work\fwh\include /ic:\work\Harbour\Include /jitaliano.HIT /iinclude;c:\work\fwh\include;c:\work\Harbour\include /oObj\test.c
Harbour 3.4.0dev () (2014-06-29 00:47)
Copyright (c) 1999-2014, https://harbour.github.io/
Compiling 'test.prg'...
Lines 1572, Functions/Procedures 5
Generating C source output to 'Obj\test.c'... Done.
[1]:Bcc32.Exe -M -c -O2  -tW -v- -X -DHB_FM_STATISTICS_OFF -DHB_NO_DEFAULT_API_MACROS -DHB_NO_DEFAULT_STACK_MACROS -DHB_OS_WIN_32 -IC:\Work\fwh\include -IC:\Work\bcc582\Include;c:\work\Harbour\Include  -nC:\Work\Prg\SOFTWA~1\INTERN~1\Obj test.c
Borland C++ 5.82 for Win32 Copyright (c) 1993, 2005 Borland
test.c:
[1]:iLink32.Exe -Gn -aa -Tpe -s @test.bcl
Turbo Incremental Link 5.69 Copyright (c) 1997-2005 Borland
Error: Unresolved external 'SHCreateDirectoryExA' referenced from C:\WORK\FWH\LIB\FIVEHC.LIB|MKDIR
Error: Unresolved external '_HB_FUN_HB_HSETCASEMATCH' referenced from C:\WORK\FWH\LIB\FIVEH.LIB|DATABASE
 



I have the last fwh 15.01
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6834
Joined: Thu Oct 18, 2012 7:17 pm

Re: Date from Internet

Postby anserkk » Mon Mar 30, 2015 11:54 am

Regarding Unresolved external 'SHCreateDirectoryExA'
Please include c:\bcc582\lib\psdk\shell32.lib.

Regarding unresolved HB_FUN_HB_HSETCASEMATCH, I understand that you yourself has asked this question earlier and resolved yourself in the below provided link.
viewtopic.php?f=3&t=29108&hilit=Unresolved+external+%27_HB_FUN_HB_HSETCASEMATCH%27#p164179
User avatar
anserkk
 
Posts: 1331
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Date from Internet

Postby rhlawek » Tue Mar 31, 2015 3:58 pm

In the harbour 3.4 fork Viktor, for consistency sake, Viktor changed the name of hb_HSetCaseMatch() to hb_HCaseMatch()

Creating a local copy of hb_HSetCaseMatch() that calls hb_HCaseMatch() is the correct solution, but the implemention in the link provided is incomplete as it doesn't handle parameters being passed to hb_HSetCaseMatch(), nor does it pass any parameters on to hb_HCaseMatch()

Below is the easy fix, and is exactly what I did several months ago to address the issue introduced after the name change.

FUNCTION hb_HSetCaseMatch( ... )

RETURN hb_HCaseMatch( ... )
User avatar
rhlawek
 
Posts: 193
Joined: Sun Jul 22, 2012 7:01 pm

Re: Date from Internet

Postby Silvio.Falconi » Wed Apr 01, 2015 4:22 pm

With Habour is compiled but then not show any times and the exe is on memoty of Pc

With xharbour give me also errors

Code: Select all  Expand view
Progetto: InternetDate, Ambiente: xFive_Pelles:
[1]:Harbour.Exe test.prg  /m /n0 /gc1 /w0 /es2 /iC:\Work\fwh\include /ic:\work\xHarbour\Include /jC:\Work\Prg\SOFTWA~1\INTERN~1\I18n\Main.hil /iinclude;c:\work\fwh\include;c:\work\xHarbour\include /oObj\test.c
xHarbour 1.2.3 Intl. (SimpLex) (Build 20140725)
Copyright 1999-2014, http://www.xharbour.org http://www.harbour-project.org/
Compiling 'test.prg'...
Generating international list to 'C:\Work\Prg\SOFTWA~1\INTERN~1\I18n\Main.hil'...
Generating C source output to 'Obj\test.c'...
Done.
Lines 98, Functions/Procedures 5, pCodes 276
[1]:Bcc32.Exe -M -c -O2  -tW -v- -X -DHB_FM_STATISTICS_OFF -DHB_NO_DEFAULT_API_MACROS -DHB_NO_DEFAULT_STACK_MACROS -DHB_OS_WIN_32 -IC:\Work\fwh\include -IC:\Work\bcc582\Include;c:\work\xHarbour\Include  -nC:\Work\Prg\SOFTWA~1\INTERN~1\Obj test.c
Borland C++ 5.82 for Win32 Copyright (c) 1993, 2005 Borland
test.c:
[1]:iLink32.Exe -Gn -aa -Tpe -s @InternetDate.bcl
Turbo Incremental Link 5.69 Copyright (c) 1997-2005 Borland
[b]Error: Unresolved external '_HB_FUN_HB_UTCOFFSET' referenced from C:\WORK\PRG\SOFTWARELOCK_OF_JEFF\INTERNETDATE\OBJ\TEST.OBJ
Error: Unresolved external 'WSAIoctl' referenced from C:\WORK\XHARBOUR\LIB\RTL.LIB|hbsocket
Error: Unresolved external '_HB_FUN_HB_BCHAR' referenced from C:\WORK\PRG\SOFTWARELOCK_OF_JEFF\INTERNETDATE\OBJ\TEST.OBJ
Error: Unresolved external '_HB_FUN_HB_VERSION' referenced from C:\WORK\PRG\SOFTWARELOCK_OF_JEFF\INTERNETDATE\OBJ\TEST.OBJ[/b]
 


the ultimate script
Code: Select all  Expand view
#include "FiveWin.ch"

#include "hbsocket.ch"
#include "hbver.ch"
#include "hbcompat.ch"

#Include "xbrowse.ch"

*------------------------------------------*
Function Main()
*------------------------------------------*

    xBrowser GetDateTimeFromNTP()
    Return




 *------------------------------------------*
Function GetDateTimeFromNTP()
*------------------------------------------*
/* This function would return the Real date and time from an internet date time server via NTP.
   If successful, Returns an array containing 3 elements ie GMT DateTime, Indian Standarrd Date Time, PC's Date Time
   If not successful then returns an empty array.

   This function depends on the the other 3 functions like hb_ntp_GetTimeUTC(),ntohl(),Bin2U()
   All these functions are available in the Harbour lib HbMisc.
   Unfortunately, the day that we made this function ie 29-Apr-2014, these functions were not included in the HbMisc supplied along
   with FWH. So next time when we get an updated Harbour ver with FWH, we can eliminate the functions
   hb_ntp_GetTimeUTC(),ntohl(),Bin2U() from this PRG. Till then it is required
*/

   LOCAL tGmtDateTime,tPcDateTime,aDateTime:={}


   TRY
     tGmtDateTime := hb_ntp_GetTimeUTC( "0.europe.pool.ntp.org" )
   CATCH
     Return aDateTime:={}
   END
   tPcDateTime:=hb_DateTime()

   aAdd(aDateTime,tGmtDateTime)  // UTC ie GMT Date Time
   aAdd(aDateTime,tGmtDateTime + hb_UTCOffset() / 86400)  // Converted to IST
   aAdd(aDateTime,tPcDateTime)  // The date time in PC
*   xbrowser aDateTime

/*
   MsgInfo("UTC Time   : "+Ttoc(tTime)+CRLF+;
           "Local Time : "+Ttoc(tTime + hb_UTCOffset() / 86400) +CRLF+;   //86400
           "Sytem Time : "+Ttoc(hb_DateTime() ) )
*/

RETURN aDateTime

*-------------------------------------------------------*
FUNCTION hb_ntp_GetTimeUTC( cServer, nPort, nTimeOut )
*-------------------------------------------------------*
   LOCAL tTime := hb_SToT( "" )
   LOCAL hSocket, cBuffer
*   DEFAULT nPort:=123
  * DEFAULT nTimeOut:=10000 // 10seconds

   IF HB_ISSTRING( cServer ) .AND. ! Empty( cServer ) .AND. ;
      ! Empty( hSocket := hb_socketOpen( , HB_SOCKET_PT_DGRAM ) )
      cBuffer := hb_BChar( 8 ) + Replicate( hb_BChar( 0 ), 47 )
      IF hb_socketSendTo( hSocket, cBuffer,,, { HB_SOCKET_AF_INET, hb_socketResolveAddr( cServer ),  nPort  } ) == hb_BLen( cBuffer )
         cBuffer := Space( 12 * 4 )
         IF hb_socketRecvFrom( hSocket, @cBuffer,,,,  nTimeOut   ) == hb_BLen( cBuffer )
            tTime := hb_SToT( "19000101" ) + ;
               Bin2U( ntohl( hb_BSubStr( cBuffer, 10 * 4 + 1, 4 ) ) ) / 86400 + ;
               ( Bin2U( ntohl( hb_BSubStr( cBuffer, 11 * 4 + 1, 4 ) ) ) / ( 2 ^ 32 ) ) / 86400
         ENDIF
      ENDIF
      hb_socketClose( hSocket )
   ENDIF

   RETURN tTime

*---------------------------*
STATIC FUNCTION ntohl( c )
*---------------------------*
   IF hb_Version( HB_VERSION_ENDIANNESS ) == HB_VERSION_ENDIAN_LITTLE
      RETURN ;
         hb_BSubStr( c, 4, 1 ) + ;
         hb_BSubStr( c, 3, 1 ) + ;
         hb_BSubStr( c, 2, 1 ) + ;
         hb_BSubStr( c, 1, 1 )
   ENDIF

   RETURN c

*---------------------------*
STATIC FUNCTION Bin2U( c )
*---------------------------*
   LOCAL l := Bin2L( c )

   RETURN iif( l < 0, l + ( 2 ^ 32 ), l )






 
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6834
Joined: Thu Oct 18, 2012 7:17 pm

Re: Date from Internet

Postby anserkk » Thu Apr 02, 2015 4:07 am

Silvio.Falconi wrote:With xharbour give me also errors

Please understand that the sample code which I posted is for Harbour. :)

Silvio.Falconi wrote:With Habour is compiled but then not show any times and the exe is on memoty of Pc


You are not using the code which I have posted, you have modified it. You removed/commented the following lines from the Function hb_ntp_GetTimeUTC( cServer, nPort, nTimeOut ). That's the reason why your exe is not destroyed from the memory and not displaying the expected results.

Code: Select all  Expand view
Function hb_ntp_GetTimeUTC( cServer, nPort, nTimeOut )
   DEFAULT nPort:=123
   DEFAULT nTimeOut:=10000 // 10seconds


The code which I posted is working fine here. After I added the lines that were commented out by you, the code which you posted in the previous post is also working fine here.

Image

Regards
Anser
User avatar
anserkk
 
Posts: 1331
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Date from Internet

Postby Silvio.Falconi » Thu Apr 02, 2015 2:46 pm

DEFAULT nPort:=123
DEFAULT nTimeOut:=10000 // 10seconds

I rem these lines because it make error on these lines when is compiling
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6834
Joined: Thu Oct 18, 2012 7:17 pm

Re: Date from Internet

Postby AntoninoP » Thu Apr 02, 2015 3:09 pm

maybe have you not included "fivewin.ch"?
It has those lines:
Code: Select all  Expand view
/*----------------------------------------------------------------------------//
!short: Default parameters management */


#xcommand DEFAULT <uVar1> := <uVal1> ;
               [, <uVarN> := <uValN> ] => ;
                  If( <uVar1> == nil, <uVar1> := <uVal1>, ) ;;
                [ If( <uVarN> == nil, <uVarN> := <uValN>, ); ]

 
AntoninoP
 
Posts: 375
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy

Re: Date from Internet

Postby Silvio.Falconi » Mon Apr 06, 2015 12:47 pm

yes.... of course .... on Harbour run ok Now also here !!!


a SOLUTION for xharbour ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6834
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: INFORMAISVRB and 35 guests