Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
Bantor asked how to get real time inside a transaction because CURRENT stays constant. Art Kagel suggested reading the time in the application, outside IDS. Jonathan Leffler explained the server freezes the time for the top-level statement, not the transaction, and mentioned DBINFO or sysmaster as ways around it. Another poster gave a sysmaster:sysshmvals sh_curtime query with DBINFO('utc_to_datetime') for procedures.
Auto-generated by Claude from the posts below — may be imperfect; read the full thread.
hi!
I'v got a problem with time in transaction.
Time in 'current' doesn't change in transaction - all the time has the same
value.
How can I get real time in transaction or time witch passed from the
begining of the transaction?
Hope You can help
Regards
↪ replying to bantor
Art S. Kagel — — source: Usenet: comp.databases.informix
bantor wrote:
> hi!
>
> I'v got a problem with time in transaction.
> Time in 'current' doesn't change in transaction - all the time has the same
> value.
> How can I get real time in transaction or time witch passed from the
> begining of the transaction?
Get the time in your application outside of the IDS transaction. If you're
coding in ESQL/C you can call gettimeofday() or just time(). For 4GL you'll
have to write a 4GL callable C routine to get the start and end times.
Art S. Kagel
> Hope You can help
> Regards
>
>
Art S. Kagel wrote:
> bantor wrote:
>> I'v got a problem with time in transaction.
>> Time in 'current' doesn't change in transaction - all the time has the
>> same value.
>> How can I get real time in transaction or time witch passed from the
>> begining of the transaction?
>
> Get the time in your application outside of the IDS transaction. If
> you're coding in ESQL/C you can call gettimeofday() or just time(). For
> 4GL you'll have to write a 4GL callable C routine to get the start and
> end times.
In I4GL (and ESQL/C or C), time changes just fine. It is the server
that locks the time when a top-level statement starts - not the
transaction per se. Now, if the top-level statement is a stored
procedure that executes a transaction, then time is frozen for the whole
period while the procedure is running, even if you execute SYSTEM "sleep
30" in the middle. In other words, IDS enforces the SQL standard's
fiction that each statement executes instantaneously (or, at least, the
clock doesn't budge while the statement is executing). However, there
are a couple of techniques for getting at the actual system time. One
is via a table in sysmaster, IIRC, and the other is via a DBINFO() call.
I don't have the details at hand - I'm sure a Google Groups search
would reveal the answer (it does: group:comp.databases.informix dbinfo
time).
--
Jonathan Leffler #include <disclaimer.h>
Email: jleffler@earthlink.net, jleffler@us.ibm.com
Guardian of DBD::Informix v2005.01 -- http://dbi.perl.org/
I cannot reproduce your problem in a transaction, but in a procedure
this a is way for a current timestamp:
select dbinfo('utc_to_datetime',sh_curtime) as current
from sysmaster:sysshmvals
Regards,
try_and_err
bantor schrieb:
> hi!
>
> I'v got a problem with time in transaction.
> Time in 'current' doesn't change in transaction - all the time has the same
> value.
> How can I get real time in transaction or time witch passed from the
> begining of the transaction?
>
> Hope You can help
> Regards
Your privacy choices
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.