[gnumeric] NOW: use 1us resolution.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] NOW: use 1us resolution.
- Date: Fri, 18 Dec 2020 19:27:50 +0000 (UTC)
commit fe3826b0358024e16e96ae8eae4e5b90efccb92e
Author: Morten Welinder <terra gnome org>
Date: Fri Dec 18 14:26:33 2020 -0500
NOW: use 1us resolution.
Implementation isn't elegant. The guts are in goffice and we might
need an extra api for this.
NEWS | 1 +
plugins/fn-date/ChangeLog | 4 ++++
plugins/fn-date/functions.c | 5 ++++-
3 files changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/NEWS b/NEWS
index c5199ccb2..f13fdd656 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,7 @@ Morten:
* Improve handling of expressions in csv files.
* Plug ssconvert leak. [#546]
* Fix bogus time match for "3.a". [#545]
+ * Use 1us resolution for NOW. [#549]
--------------------------------------------------------------------------
Gnumeric 1.12.48
diff --git a/plugins/fn-date/ChangeLog b/plugins/fn-date/ChangeLog
index 897bfc9e9..6ca89612b 100644
--- a/plugins/fn-date/ChangeLog
+++ b/plugins/fn-date/ChangeLog
@@ -1,3 +1,7 @@
+2020-12-18 Morten Welinder <terra gnome org>
+
+ * functions.c (gnumeric_now): Use 1us resolution.
+
2020-08-12 Morten Welinder <terra gnome org>
* Release 1.12.48
diff --git a/plugins/fn-date/functions.c b/plugins/fn-date/functions.c
index feff232cc..206ab1fa9 100644
--- a/plugins/fn-date/functions.c
+++ b/plugins/fn-date/functions.c
@@ -410,7 +410,10 @@ static GnmFuncHelp const help_now[] = {
static GnmValue *
gnumeric_now (GnmFuncEvalInfo *ei, G_GNUC_UNUSED GnmValue const * const *argv)
{
- return value_new_float (go_date_timet_to_serial_raw (time (NULL), DATE_CONV (ei->pos)));
+ guint64 t = g_get_real_time ();
+ double r = go_date_timet_to_serial_raw (t / 1000000, DATE_CONV (ei->pos));
+ r += (t % 1000000) / (24 * 60 * 60 * 1000000.0);
+ return value_new_float (r);
}
/***************************************************************************/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]