Subject Re[3]: [firebird-php] timestamp milliseconds
Author Daniel Miller
After further review of the docs - I see that the ibase_ functions
return timestamps based on the php.ini ibase.timestampformat setting.
And this is used by the strftime function - which has no provision for
subsecond information.

I consider this a Php-Firebird bug - and have filed one accordingly -
https://bugs.php.net/bug.php?id=75324. Guess I'll continue to use my
workaround in the meantime.

--
Daniel

On 10/5/2017 6:25:19 PM, "Daniel Miller" <dmiller@...> wrote:

>The records are inserted using a stored procedure that references
>current_timestamp. So the records are created within Firebird using
>Firebird native data & manipulation - hence the subsecond precision.
>
>I *could* probably revise the implementation to remove the subseconds;
>either revising the stored proc or by generating the timestamp in Php -
>but I don't see why I should have to.
>
>Because of my table structure, I have to first obtain a list of
>timestamps, and then retrieve groups of records based on those
>timestamps. These are then stored in an array for later manipulation
>(primarily by Smarty).
>
>It might be possible to build this using a stored procedure - but it
>would be rather complicated to return the results. I'd probably still
>have to massage the return to get the correct array structure. So my
>present data retrieval via Php remains the way I need it - the issue is
>still how to obtain the "full" timestamp.
>
>I am *not* using PDO - just the straight ibase_ functions. So my
>question remains - "raw" Firebird queries within Flamerobin show the
>subsecond precision, but the returns from ibase_fetch_object do not.
>Is there a way to do so?
>
>--
>Daniel
>
>On 10/5/2017 11:48:11 AM, "Lester Caine lester@...
>[firebird-php]" <firebird-php@yahoogroups.com> wrote:
>
>>On 05/10/17 19:05, 'Daniel Miller' dmiller@... [firebird-php]
>>wrote:
>>>well...something like:
>>>
>>>using arcane incantations of ibase_query...perform something similar
>>>to
>>>"select SOMETIME from SOMETABLE rows 1;" and store in $phpvar.
>>>
>>>So $phpvar now has a timestamp - but lacking the milliseconds.
>>>
>>>Now, go looking for that:
>>>"select VALUE, ABLE, INFO from SOMEOTHERTABLE where SOMETIME =
>>>$phpvar"
>>>
>>>This will return a null set. So my functional but highly offensive
>>>workaround is:
>>>"select VALUE, ABLE, INFO from SOMEOTHERTABLE where
>>> (SOMETIME - cast($phpvar as timestamp)) > 0
>>> and (SOMETIME - cast($phpvar as timestamp)) < .001
>>> and datediff(second from (SOMETIME - cast($phpvar as timestamp)) =
>>>0"
>>>
>>>There has got to be a better way to do this.
>>
>>What value are you putting in 'SOMETIME'?
>>https://firebirdsql.org/file/documentation/reference_manuals/fblangref25-en/html/fblangref25-datatypes-datetime.html
>>flags just which presets return milliseconds and which do not, but
>>part
>>of the problem with your example is that '$phpvar' is not the best
>>value
>>to use as a key into other data. A generator value will prevent
>>problems
>>with time stamps that clash ... which is something I have been hit by
>>in
>>the past ;)
>>
>>If you must use the raw timestamp as a key, then I'm still a little
>>confused since while I'm using second accurate data, it still displays
>>the '.000' in every timestamp string. What are you using to access
>>Firebird php_interbase or pdo_firebird? I only use the Interbase
>>driver
>>not the PDO one, so I'm not sure if the PDO::FB_ATTR_TIMESTAMP_FORMAT
>>trims the milliseconds on the PDO one ...
>>
>>--
>>Lester Caine - G8HFL
>>-----------------------------
>>Contact - http://lsces.co.uk/wiki/?page=contact
>>L.S.Caine Electronic Services - http://lsces.co.uk
>>EnquirySolve - http://enquirysolve.com/
>>Model Engineers Digital Workshop - http://medw.co.uk
>>Rainbow Digital Media - http://rainbowdigitalmedia.co.uk
>>
>>
>>------------------------------------
>>Posted by: Lester Caine <lester@...>
>>------------------------------------
>>
>>
>>------------------------------------
>>
>>Yahoo Groups Links
>>
>>
>>