[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] JavaScript-ur



"Michael Schmidt" <sslug@sslug> writes:

>> - med mindre du selvfølgelig implementerer en hel lille ntp klient i
>> javascript :-)
> Inden jeg pløjer Google igennem for 100 dårlige hits og en smule
> guldkorn,  har du så evt. info om noget sådan allerede er lavet?

ntp er måske lige lidt overkill.

Jeg er ikke den store javascript-haj, så mere på skitseform.

Hvis du forbinder dig til port 37 på sunsite.dk får du et 32bit tal
retur (network order, big-endian) der fortæller antallet af sekunder
siden 1. januar 1900.

I javascript kan du instantierer et Date-objekt med antallet af
millisekunder siden 1. januar 1970. Der er 2.208.988.800 sekunder fra
1. januar 1900 til 1. januar 1970 (læs RFC 868).


Med perl kan man gøre følgende:

nc sunsite.dk time | perl -ne 'print scalar localtime(unpack("N",$_)-2208988800)'



Men er det ikke et problem at forbinde sig til en tredjepart i
client-side javascript?

Jeg ville heller ikke stole på at bruge en service på sunsite.dk som
ikke kører på dotsrc.org.
 
-- 
 Peter Makholm     |                                              What if:
 sslug@sslug |     IBM bought Xenix from Microsoft instead of buying
 http://hacking.dk |                                                  DOS?


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:44 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *