incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stanley Iriele <siriele...@gmail.com>
Subject Re: CouchDB: Timestamp inaccurate and seems to be cached
Date Wed, 08 Jan 2014 19:18:28 GMT
Maps should not be used for that... Also...why can't show or list functions
be used for that?...
On Jan 8, 2014 10:59 AM, "Hank Knight" <hknight555@gmail.com> 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.
>
> On Wed, Jan 8, 2014 at 10:17 AM, Hank Knight <hknight555@gmail.com> wrote:
> > I use this Map Function to get the current Unix timestamp:
> >
> > function(doc) {emit(Math.round(new Date().getTime()/1000), null  );}
> >
> > 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?
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message