Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 91E7110EF2 for ; Wed, 8 Jan 2014 19:40:45 +0000 (UTC) Received: (qmail 4353 invoked by uid 500); 8 Jan 2014 19:40:44 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 4308 invoked by uid 500); 8 Jan 2014 19:40:44 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 4300 invoked by uid 99); 8 Jan 2014 19:40:43 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Jan 2014 19:40:43 +0000 X-ASF-Spam-Status: No, hits=-0.1 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of jeanfelixg@icloud.com designates 17.172.108.249 as permitted sender) Received: from [17.172.108.249] (HELO st11p05mm-asmtp001.mac.com) (17.172.108.249) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Jan 2014 19:40:35 +0000 Received: from [10.0.1.5] (cable-224.127.96-86.electronicbox.net [96.127.224.86]) by st11p05mm-asmtp001.mac.com (Oracle Communications Messaging Server 7u4-27.08(7.0.4.27.7) 64bit (built Aug 22 2013)) with ESMTPSA id <0MZ300DHOLAXXNB0@st11p05mm-asmtp001.mac.com> for user@couchdb.apache.org; Wed, 08 Jan 2014 19:40:11 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.11.87,1.0.14,0.0.0000 definitions=2014-01-08_08:2014-01-07,2014-01-08,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=5 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1308280000 definitions=main-1401080112 From: Jean-Felix Girard Content-type: multipart/alternative; boundary="Apple-Mail=_3B07E136-3765-489F-8556-5FFD1602B5AD" Message-id: <7231BBE3-83BD-4C83-9B61-A49CB1335957@icloud.com> MIME-version: 1.0 (Mac OS X Mail 7.1 \(1827\)) Subject: Re: CouchDB: Timestamp inaccurate and seems to be cached Date: Wed, 08 Jan 2014 14:40:09 -0500 References: To: user@couchdb.apache.org In-reply-to: X-Mailer: Apple Mail (2.1827) X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail=_3B07E136-3765-489F-8556-5FFD1602B5AD Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 I just noticed that Couchdb returns a "Date" response header. < HTTP/1.1 200 OK < Transfer-Encoding: chunked < Server: CouchDB/1.5.0 (Erlang OTP/R16B02) < ETag: "4E9MYK7J4X9CKM0EUK0V1K7IZ" < Date: Wed, 08 Jan 2014 19:34:38 GMT < Content-Type: text/plain; charset=3Dutf-8 < Cache-Control: must-revalidate You can parse that date (from the GET request on the view) and compare = it to the document date to find out theirs age. Jeff On Jan 8, 2014, at 1:58 PM, Hank Knight wrote: > I want to get the current timestamp according to the CouchDB server > using a GET request. When new documents are created, an update > function is used to add a timestamp to a document. When I get a > result set, it is important to know the server's current timestamp so > the age of the documents in the result set can be correctly > determined. >=20 > On Wed, Jan 8, 2014 at 10:17 AM, Hank Knight = wrote: >> I use this Map Function to get the current Unix timestamp: >>=20 >> function(doc) {emit(Math.round(new Date().getTime()/1000), null );} >>=20 >> The odd thing is, it returns a correct timestamp the first time I run >> a query but it returns the exact same timestamp one minute later even >> though 60 seconds have passed! Is this due to caching or something >> else? What is the best way for me to always get the current Unix >> timestamp? --Apple-Mail=_3B07E136-3765-489F-8556-5FFD1602B5AD--