Flourish PHP Unframework
This is an archived copy of the forum for reference purposes

fTimestamp error in documentation and question

posted by aurelien 9 years ago
$now = new fTimestamp();
$day_ago = new fTimestamp('-1 day');
 
// These return TRUE
$now->eq();
$now->eq('now');
$now->gt($day_ago);
$now->gte($day_ago);
$now->lt('+5 min');
 
// These calls return FALSE
$day_ago->lt($now);
$now->gt($day_ago);
$now->gte($day_ago);

The "FALSE" commands also returns true... well 2 of them are actually the same as above :)

Question : Is the following really true ??

$now->eq('now');

I thought that when $now is stored, is different from the timestamp it makes when invoquing lt method with 'now' param.

Maybe it is the same except if the script is so slow the two commands take place on a different second (which could happen even for the example if the script runs exactly at the time of going from one second to another)

Yes?

Aurelien

You are right - it is entirely possible that the code will occur at the exact moment before a second change, and then the second statement after the second change.

Thanks for the bug report - I've added a ticket to make sure I get it updated

posted by wbond 9 years ago