Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.017 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'receives': 0.04; 'protocols,': 0.09; 'cc:addr:python-list': 0.11; 'jan': 0.12; 'bashir': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'hits': 0.16; 'offsets': 0.16; 'readable': 0.16; 'subject:Convert': 0.16; 'subject:format': 0.16; 'timestamp': 0.16; 'wrote:': 0.18; '(the': 0.22; 'cc:addr:python.org': 0.22; '31,': 0.24; 'format,': 0.24; 'sends': 0.24; 'guys': 0.24; 'cc:2**0': 0.24; 'sort': 0.25; 'task': 0.26; 'header:In-Reply- To:1': 0.27; 'specifically': 0.29; 'correct': 0.29; 'appreciated.': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'ones.': 0.31; 'fri,': 0.33; 'subject:time': 0.33; 'subject:from': 0.34; 'case,': 0.35; 'convert': 0.35; 'received:google.com': 0.35; 'should': 0.36; 'server': 0.38; 'awesome': 0.38; 'read': 0.60; 'authority': 0.60; "you're": 0.61; 'results': 0.69; 'internet': 0.71; 'obvious': 0.74; 'article': 0.77; 'everyone;': 0.84; 'to:none': 0.92; 'matter),': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=BBYpO2Silm1IDX0IhMi9URJgUn6yFZeoG3GQ8Jt2cdA=; b=Ge8N3LiVXI8P01gNWK2g+xGqHm1FnPtMJoIUvksXyVK0Elw9TgQlfGox4IOCB108SS /6CteOgFXQ5stnvrN4zkK6wWJMNvJEYs66gYQ/LOLQkfiONqazu6vNgqCGZa/Ed06K5O 5dlnxJ/hgO4XR2JntmBglarMQDhlzdM6zhtCiLuLeIKgiji9A0Vo96MFt+SzGIyzahrX ZTAjnbbgpQQ+0FCidNt9v8uD+nNWc93ZAivHRmrYP6N0JB9ofmFfp4wwWleek88jC1nz 8EYHmWGu71ZYAf5BH4PloqfqUfYHIGBSc1L+WFBuE5P9fntnTafsMyusmchlCNJiDZaN RLCw== MIME-Version: 1.0 X-Received: by 10.66.164.229 with SMTP id yt5mr14652698pab.67.1391090555055; Thu, 30 Jan 2014 06:02:35 -0800 (PST) In-Reply-To: References: Date: Fri, 31 Jan 2014 01:02:35 +1100 Subject: Re: Convert NTP timestamp from NTP packet to System time and date format From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1391090565 news.xs4all.nl 2894 [2001:888:2000:d::a6]:59895 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:65003 On Fri, Jan 31, 2014 at 12:34 AM, Sadia Bashir <11msccssbashir@seecs.edu.pk> wrote: > Hello everyone; > > I want to write NTP client which sends and receives NTP packet to NTP server > and should read the value from one of the four offsets and convert it to > user readable local or GMT time format, I specifically want to know which > offsets should I read in order to get correct timestamp from the packet. > Any suggestion or help will be appreciated. > Any time you're looking at network protocols, the one obvious place to look is the RFCs. Just do a web search for 'rfc ntp' to find the relevant ones. In my case, the search results pulled up a couple of good-looking hits from ietf.org (the Internet Engineering Task Force - those guys are the authority on this sort of matter), plus the Wikipedia article for NTP, with a section "Relevant RFCs", which would make good reading. Enjoy! Networking's awesome fun. ChrisA