[Bug 161469] NOW() Function in Calc Macro Omits Sub-Seconds
https://bugs.documentfoundation.org/show_bug.cgi?id=161469 Andreas Heinisch changed: What|Removed |Added Status|NEW |ASSIGNED Assignee|libreoffice-b...@lists.free |andreas.heini...@yahoo.de |desktop.org | -- You are receiving this mail because: You are the assignee for the bug.
[Bug 161469] NOW() Function in Calc Macro Omits Sub-Seconds
https://bugs.documentfoundation.org/show_bug.cgi?id=161469 --- Comment #7 from Andreas Heinisch --- Code base with a many many different developers grown over time under different management -- You are receiving this mail because: You are the assignee for the bug.
[Bug 161469] NOW() Function in Calc Macro Omits Sub-Seconds
https://bugs.documentfoundation.org/show_bug.cgi?id=161469 --- Comment #6 from Werner Tietz --- disclaimer: I'm NOT a c++ programmer @ https://opengrok.libreoffice.org/xref/core/basic/source/runtime/methods.cxx#2117 ? should it work with: ``` 2117 double Now_Impl() 2118 { 2119 DateTime aDateTime( DateTime::SYSTEM ); 2120 double aSerial = static_cast(GetDayDiff( aDateTime )); 2121 tools::Long nSeconds = aDateTime.GetHour(); 2122 nSeconds *= 3600; 2123 nSeconds += aDateTime.GetMin() * 60; 2124 nSeconds += aDateTime.GetSec(); 2125 double nDays = static_cast(nSeconds) / (24.0*3600.0); +2126 nano = aDateTime.GetNanoSec(); +2127 divisor = 864000.0; +2128 double nanoSeconds = static_cast nano / divisor ; 2129 aSerial += nDays; +2130 aSerial += nanoSeconds; 2129 return aSerial; 2130 } ``` ??? @Andreas Heinisch: but the question is: Why doesnt »Basic_now« use the same source as the »calc_now« ? both works obviously with the same epoch »1899-12-30« -- You are receiving this mail because: You are the assignee for the bug.
[Bug 161469] NOW() Function in Calc Macro Omits Sub-Seconds
https://bugs.documentfoundation.org/show_bug.cgi?id=161469 Andreas Heinisch changed: What|Removed |Added Ever confirmed|0 |1 Status|UNCONFIRMED |NEW --- Comment #5 from Andreas Heinisch --- Repro in: Version: 7.6.1.2 (X86_64) / LibreOffice Community Build ID: f5defcebd022c5bc36bbb79be232cb6926d8f674 CPU threads: 16; OS: Windows 10.0 Build 22631; UI render: Skia/Raster; VCL: win Locale: en-GB (de_DE); UI: en-GB Calc: CL threaded Code pointer: https://opengrok.libreoffice.org/xref/core/basic/source/runtime/methods.cxx#2117 -- You are receiving this mail because: You are the assignee for the bug.
[Bug 161469] NOW() Function in Calc Macro Omits Sub-Seconds
https://bugs.documentfoundation.org/show_bug.cgi?id=161469 --- Comment #4 from Daniel Baran --- Having researched this further, I found that this rounding to seconds is a known behavior of the NOW() function in Basic. https://forum.openoffice.org/en/forum/viewtopic.php?p=455955&sid=32227f1e230f851464c32171720f030e#p455955 The suggested solution works for me in Libre Calc. Example: Dim TimeStamp() Dim svc As Object svc = createUnoService("com.sun.star.sheet.FunctionAccess") Cell.Value = svc.callFunction("NOW",TimeStamp()) It is a somewhat unanticipated behavior of the NOW() function. It's not clear to me what Status is warranted. -- You are receiving this mail because: You are the assignee for the bug.
[Bug 161469] NOW() Function in Calc Macro Omits Sub-Seconds
https://bugs.documentfoundation.org/show_bug.cgi?id=161469 --- Comment #3 from Werner Tietz --- Hello Daniel my suggestion is not a WORKAROUND, because python, like basic, is a programming language available in Libreoffice. There exists nowadays NO Libreoffice-package WITHOUT python**! **either embedded into LO, or linked to the python-environment of the Operating System -- You are receiving this mail because: You are the assignee for the bug.
[Bug 161469] NOW() Function in Calc Macro Omits Sub-Seconds
https://bugs.documentfoundation.org/show_bug.cgi?id=161469 Daniel Baran changed: What|Removed |Added CC||d.j.ba...@frontier.com --- Comment #2 from Daniel Baran --- Thank you Werner. I can confirm that your workaround works exactly as I intended. I had to go learn how to employ Python in LO for the first time. The only drawback is that the time-tracking utility I've built is intended to be distributed to LO users who may not have Python installed on their machines. So I'm hoping there is (or will be) a way to do the same thing in LO Basic. -- You are receiving this mail because: You are the assignee for the bug.
[Bug 161469] NOW() Function in Calc Macro Omits Sub-Seconds
https://bugs.documentfoundation.org/show_bug.cgi?id=161469 --- Comment #1 from Werner Tietz --- this python-snippet works as expected: ``` from datetime import datetime as dt def timestamp(*event): doc = XSCRIPTCONTEXT.getDocument() sel = doc.CurrentSelection sel.Formula = f'{dt.now().isoformat()}' ``` -- You are receiving this mail because: You are the assignee for the bug.