Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

APEX_UTIL.GET_SINCE off by 6 minutes

Tags:

How can it be that APEX_UTIL.GET_SINCE with the current time tells me that that timestamp is 6 minutes in the future? Before it worked as expected and returned 'now' but since a short while it is saying that the current date is in the future.

The System time of the underlying Linux System has the correct time (up to a milisecond) and the sysdate returned by that statement is also the correct current time, so I expect that Oracle function to use a wrong reference from somewhere else?

enter image description here

like image 870
Dominik Avatar asked Oct 18 '19 17:10

Dominik


1 Answers

As far as I can tell, it doesn't

tell that timestamp is 6 minutes in the future

but in the past.


It looks as if the first call sets a "mark", and subsequent calls return how much time has passed since that.

The first call is at 19:39:11 and it is "now":

SQL> select to_char(sysdate, 'hh24:mi:ss') sysd, apex_util.get_since(sysdate) result from dual;

SYSD     RESULT
-------- --------------------------------------------------
19:39:11 Now

I'm now just pressing the UP key on the keyboard and hitting the ENTER:

SQL> select to_char(sysdate, 'hh24:mi:ss') sysd, apex_util.get_since(sysdate) result from dual;

SYSD     RESULT
-------- --------------------------------------------------
19:39:12 1 seconds from now

SQL> select to_char(sysdate, 'hh24:mi:ss') sysd, apex_util.get_since(sysdate) result from dual;

SYSD     RESULT
-------- --------------------------------------------------
19:39:13 2 seconds from now

SQL> select to_char(sysdate, 'hh24:mi:ss') sysd, apex_util.get_since(sysdate) result from dual;

SYSD     RESULT
-------- --------------------------------------------------
19:39:14 3 seconds from now

SQL> select to_char(sysdate, 'hh24:mi:ss') sysd, apex_util.get_since(sysdate) result from dual;

SYSD     RESULT
-------- --------------------------------------------------
19:39:15 4 seconds from now

SQL> select to_char(sysdate, 'hh24:mi:ss') sysd, apex_util.get_since(sysdate) result from dual;

SYSD     RESULT
-------- --------------------------------------------------
19:39:16 5 seconds from now

SQL>

After typing the above message (I mean, answering the question), I'm calling it again; it says that it's been 3 minutes since the mark:

SQL> select to_char(sysdate, 'hh24:mi:ss') sysd, apex_util.get_since(sysdate) result from dual;

SYSD     RESULT
-------- --------------------------------------------------
19:41:41 3 minutes from now

SQL>

In order to reset it, I'm exiting SQL*Plus and starting over:

SQL> exit
Disconnected from Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

c:\Temp>sqlplus scott/tiger

SQL*Plus: Release 11.2.0.2.0 Production on Pet Lis 18 19:42:31 2019

Copyright (c) 1982, 2014, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

SQL> col result format a50

New mark set to 19:42:36:

SQL> select to_char(sysdate, 'hh24:mi:ss') sysd, apex_util.get_since(sysdate) result from dual;

SYSD     RESULT
-------- --------------------------------------------------
19:42:36 Now

SQL> select to_char(sysdate, 'hh24:mi:ss') sysd, apex_util.get_since(sysdate) result from dual;

SYSD     RESULT
-------- --------------------------------------------------
19:42:38 2 seconds from now

SQL> select to_char(sysdate, 'hh24:mi:ss') sysd, apex_util.get_since(sysdate) result from dual;

SYSD     RESULT
-------- --------------------------------------------------
19:42:39 3 seconds from now

SQL>
like image 152
Littlefoot Avatar answered Sep 29 '22 00:09

Littlefoot