Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.musoftware.de!wum.musoftware.de!wieslauf.sub.de!.POSTED!reversiblemaps.ath.cx!not-for-mail From: Jasen Betts Newsgroups: comp.os.linux.development.apps Subject: Re: time conversion Date: 28 Jan 2012 21:15:42 GMT Organization: Dis (not Dat) Organisation Lines: 24 Message-ID: References: NNTP-Posting-Host: ip-118-90-69-86.xdsl.xnet.co.nz Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: wieslauf.sub.de 1327910020 10840 118.90.69.86 (30 Jan 2012 07:53:40 GMT) X-Complaints-To: usenet@wieslauf.sub.de NNTP-Posting-Date: Mon, 30 Jan 2012 07:53:40 +0000 (UTC) User-Agent: slrn/pre1.0.0-18 (Linux) X-Face: ?)Aw4rXwN5u0~$nqKj`xPz>xHCwgi^q+^?Ri*+R(&uv2=E1Q0Zk(>h!~o2ID@6{uf8s;a +M[5[U[QT7xFN%^gR"=tuJw%TXXR'Fp~W;(T"1(739R%m0Yyyv*gkGoPA.$b,D.w:z+<'"=-lVT?6 {T?=R^:W5g|E2#EhjKCa+nt":4b}dU7GYB*HBxn&Td$@f%.kl^:7X8rQWd[NTc"P"u6nkisze/Q;8 "9Z{peQF,w)7UjV$c|RO/mQW/NMgWfr5*$-Z%u46"/00mx-,\R'fLPe.)^ Xref: x330-a1.tempe.blueboxinc.net comp.os.linux.development.apps:410 On 2012-01-26, Bill M wrote: > What is the easiest way to convert a time value that is the number > of microseconds that have elapsed since 0000 hours 1 January 1972 into > the unixepoch (the number of seconds since 0000 hours 1 January 1970). > > Is there some time function for this already? Or do I need to use struct tm? no, and no. divide by 1000000 which converts microseconds into seconds and then add (2x365x25x60x60) which is the missing tw yars worth of seconds I am assuming both schemes agree about leap seconds. hmm, 1972 eh? You may find enlightenment in the source of ntpdate, but be aware that the NTP epoch differs by 10 seconds from the one you describe. -- ⚂⚃ 100% natural