|
From: Mike R. <mry...@gm...> - 2015-09-23 20:11:35
|
We use the C tm struct to hold parsed timestamps on the way to returning a time_t, and the tm_usec field is not available per the standard[1] even though some C libraries define it. I think a reasonable API extension would be a function to read the microseconds part of a timestamp field, separate from the time_t value. It's likely that a pseudo-time such as 'now' was was used to generate the stored timestamps. [1] http://pubs.opengroup.org/onlinepubs/007908775/xsh/time.h.html Hope that helps, -- Mike Rylander | President | Equinox Software, Inc. / The Open Source Experts | phone: 1-877-OPEN-ILS (673-6457) | email: mi...@es... | web: http://www.esilibrary.com On Wed, Sep 23, 2015 at 1:21 AM, Kjell Irgens <kj...@sp...> wrote: > Hi, > > I use libdbi to access a database in some software I have made at work. > The database is postgresql. In one of the tables I need to have higher > time resolution than just whole seconds. The dbi_result_get_datetime() > function fetches data as time_t: > > > http://libdbi.sourceforge.net/docs/programmers-guide/reference-field.html#DBI-RESULT-GET-DATETIME > > I have had to create a column nsec in my table to hold the > fraction-of-a-second information. This is what I get when I do a query > from psql: > > SELECT time,nsec FROM prop LIMIT 1 > time | nsec > ------------------------------------- > 2015-09-22 20:46:11.843 | 842523000 > > Inserts were done via libdbi. So clearly libdbi has passed on more than > whole second precition to postgresql. Postgresql stores microseconds in > the timestamp type: > > http://www.postgresql.org/docs/9.1/static/datatype-datetime.html > > I would be very nice somehow to be able to pull this information out, and > get rid of the extra nsec column. Is that possible? > > --Kjell > > > > CONFIDENTIALITY > This e-mail and any attachment contain KONGSBERG information which may be > proprietary, confidential or subject to export regulations, and is only > meant > for the intended recipient(s). Any disclosure, copying, distribution or > use is > prohibited, if not otherwise explicitly agreed with KONGSBERG. If received > in > error, please delete it immediately from your system and notify the sender > properly. > > > > ------------------------------------------------------------------------------ > Monitor Your Dynamic Infrastructure at Any Scale With Datadog! > Get real-time metrics from all of your servers, apps and tools > in one place. > SourceForge users - Click here to start your Free Trial of Datadog now! > http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140 > _______________________________________________ > Libdbi-drivers-devel mailing list > Lib...@li... > https://lists.sourceforge.net/lists/listinfo/libdbi-drivers-devel > |