Author Topic: Uptime  (Read 10413 times)

0 Members and 1 Guest are viewing this topic.

mailmaverick

  • Bull Frog
  • Posts: 493
Re: Uptime
« Reply #15 on: November 14, 2014, 01:02:41 PM »
The DATE solution suggested may not work if the user changes system date.

Is there any other fool proof method ?
one can query internet time

Yes Good Option, What is the LISP code to query internet time ?


VovKa

  • Water Moccasin
  • Posts: 1631
  • Ukraine
Re: Uptime
« Reply #16 on: November 14, 2014, 02:20:53 PM »
Yes Good Option, What is the LISP code to query internet time ?
http://www.theswamp.org/index.php?topic=33065.0
Code: [Select]
(vk_ReadXML "http://developer.yahooapis.com/TimeService/V1/getTime?appid=YahooDemo")
Code: [Select]
(defun vk_UnixTime2AcadTime (u) (+ 2440588.0 (/ u 86400.0)))

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Uptime
« Reply #17 on: November 15, 2014, 06:44:16 AM »
The DATE solution suggested may not work if the user changes system date.

Is there any other fool proof method ?
one can query internet time

Yes Good Option, What is the LISP code to query internet time ?

Another:
http://www.theswamp.org/index.php?topic=39491.msg447974#msg447974

hermanm

  • Guest
Re: Uptime
« Reply #18 on: November 15, 2014, 01:39:52 PM »
nice job, Lee.:)

Note that NIST:

http://tf.nist.gov/tf-cgi/servers.cgi

is recommending ntp as replacement for the old "DAYTIME" protocol

thus:
Code - Auto/Visual Lisp: [Select]
  1. (setq server "ntp://time.nist.gov/");newer protocol
  2.  

works here.

@ mailmaverick:
yes, true enough.
by default, though, Windows systems are set to sync with a time server
so, it takes a conscious act to de-sync system time,
which would result in all local time stamps becoming inaccurate.
Is it likely someone would do that, just to run an expired AutoLISP demo?
I think not, but perhaps I am mistaken.

In any case, locks only keep out the honest folks.
JMO.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Uptime
« Reply #19 on: November 15, 2014, 05:38:38 PM »
nice job, Lee.:)

Note that NIST:

http://tf.nist.gov/tf-cgi/servers.cgi

is recommending ntp as replacement for the old "DAYTIME" protocol

thus:
Code - Auto/Visual Lisp: [Select]
  1. (setq server "ntp://time.nist.gov/");newer protocol
  2.  

works here.

Many thanks Herman  :-)

I haven't revisited the code in 3 years (wow - that's gone by fast!), so thank you for the heads-up on the new server url.

Lee

El Bachaco

  • Newt
  • Posts: 26
Re: Uptime
« Reply #20 on: November 15, 2014, 06:49:39 PM »
thanks guys for all your help .....!

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Uptime
« Reply #21 on: March 29, 2015, 09:19:37 PM »
I was wondering if querying internet time is possible then finally end up to this nice thread. Thanks to everyone.
I tried Lee's code but find this does not work:
Code: [Select]
(setq server "ntp://time.nist.gov/")
unless use the old one:
Code: [Select]
(setq server "http://time.nist.gov:13")

And the page is not exist anymore:
http://tf.nist.gov/tf-cgi/servers.cgi

Can you please confirm if the 2nd one above is still correct?
Many thanks.

VovKa

  • Water Moccasin
  • Posts: 1631
  • Ukraine
Re: Uptime
« Reply #22 on: March 30, 2015, 06:30:24 AM »
there's yet another way to query internet time
Code: [Select]
(defun vk_GetRemoteFileHeaders (RemoteFileName Headers / objHTTP Result)
  (if (setq objHTTP (vlax-create-object "WinHTTP.WinHTTPRequest.5.1"))
    (progn (setq Result (vl-catch-all-apply
  (function
    (lambda ()
      (vlax-invoke-method objHTTP "Open" "HEAD" RemoteFileName :vlax-false)
      (vlax-invoke objHTTP "Send")
      (if (= (vlax-get-property objHTTP "Status") 200)
(mapcar (function (lambda (h / r)
    (setq r (vl-catch-all-apply
      'vlax-invoke-method
      (list objHTTP "GetResponseHeader" h)
    )
    )
    (cons h
  (if (not (vl-catch-all-error-p r))
    r
  )
    )
  )
)
Headers
)
      )
    )
  )
)
   )
   (vlax-release-object objHTTP)
   (if (and Result (not (vl-catch-all-error-p Result)))
     Result
   )
    )
  )
)
Code: [Select]
(defun vk_GetInternetTime (/)
  (cdar (vk_GetRemoteFileHeaders "http://www.google.com" (list "Date")))
)
any server can be used, even http://www.theswamp.org :)

ur_naz

  • Newt
  • Posts: 68
  • Made in Ukraine
Re: Uptime
« Reply #23 on: March 30, 2015, 09:36:28 AM »
While any VL Application can be decompiled you cannot protect it any code you write

El Bachaco

  • Newt
  • Posts: 26
Re: Uptime
« Reply #24 on: March 30, 2015, 05:09:13 PM »
friends ..... thank you very much to all of you for your work and time.......

mailmaverick

  • Bull Frog
  • Posts: 493
Re: Uptime
« Reply #25 on: April 01, 2015, 02:40:05 PM »
While any VL Application can be decompiled you cannot protect it any code you write

How can a VLX be decompiled into LISP code ?