Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

bug in smarty (function and subtemplate)
Goto page Previous  1, 2
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Fri Mar 20, 2015 3:39 pm    Post subject: Reply with quote

How CURRENT_TIMESTAMP is stored is of no interest. You are not working with database files directly.
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Fri Mar 20, 2015 4:28 pm    Post subject: Reply with quote

Hey
I was discussing with sm@rty the 'modified' field definition we had used in our MYSQL cache resource in the demo folder where we used MSQL's 'CURRENT_TIMESTAMP' which is a string.

AnrDaemon wrote:
sm@rty wrote:
no problem in mysql.
Quote:

`modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,


CURRENT_TIMESTAMP is string date time.

CURRENT_TIMESTAMP is a timestamp, not a string.
You can use it in any datetime context directly.


You brought up that it is not a string which, was a wrong statement....
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Fri Mar 20, 2015 10:39 pm    Post subject: Reply with quote

Judging from your code, you was doing it wrong all along, to begin with.
Retrieving a ready to use UNIX timestamp only to convert it back and forth, instead of comparing two timestamps directly, is. Just. Plain. Wrong.
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Sat Mar 21, 2015 4:38 am    Post subject: Reply with quote

AnrDaemon wrote:
Judging from your code, you was doing it wrong all along, to begin with.
Retrieving a ready to use UNIX timestamp only to convert it back and forth, instead of comparing two timestamps directly, is. Just. Plain. Wrong.


Again wrong! Not converting it back and forth. MYSQL does update 'CURRENT_TIMESTAMP' internally on each record update so it's not depending on some timestamp you provide.
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Sat Mar 21, 2015 7:34 am    Post subject: Reply with quote

"Provide" what? You can compare it with timestamp from your template file.
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Sat Mar 21, 2015 8:58 am    Post subject: Reply with quote

AnrDaemon wrote:
"Provide" what? You can compare it with timestamp from your template file.


If you update the template in the database you do not need to assign a timestamp value to the 'modified' field. MYSQL does fill it automatically (as string).
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP