Raised This Month: $51 Target: $400
 12% 

get_systime() problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
killergirl
Senior Member
Join Date: Jul 2010
Old 07-18-2012 , 16:12   get_systime() problem
Reply With Quote #1

Not all the time, but sometimes get_systime() is returning me 0. I don't know why...

Is there any other function to get the current time in seconds format?
killergirl is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 07-18-2012 , 16:18   Re: get_systime() problem
Reply With Quote #2

In what case is it happening?
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
killergirl
Senior Member
Join Date: Jul 2010
Old 07-18-2012 , 16:52   Re: get_systime() problem
Reply With Quote #3

I'm sending a query to a mysql server when a player has disconnected

PHP Code:
static query[256]

formatex(querycharsmax(query), "INSERT INTO `asd` (id, timestamp) VALUES ('', '%d')"get_systime() ) 
In some cases, the get_systime() is returning 0 or 1. I don't know why...
killergirl is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 07-18-2012 , 17:05   Re: get_systime() problem
Reply With Quote #4

How do you know it is returning 0 or 1?
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 07-18-2012 , 18:02   Re: get_systime() problem
Reply With Quote #5

Are you sure that "timestamp" field it's an INT ?
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
killergirl
Senior Member
Join Date: Jul 2010
Old 07-18-2012 , 20:41   Re: get_systime() problem
Reply With Quote #6

@meta
Yes, is it INT (11).

Like I said, in some cases, not all the time. When I'm getting information from the database, in some cases when I convert them into php date, the date is 1970 (because the timestamp is 0).

@exolent
Because I wrote a function for debug, I'm sending & logging all the queries sent to mysql server.
killergirl is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 07-18-2012 , 22:00   Re: get_systime() problem
Reply With Quote #7

Do you tried SYSDATE() ?
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 07-18-2012 , 22:06   Re: get_systime() problem
Reply With Quote #8

Quote:
Originally Posted by lucas_7_94 View Post
Do you tried SYSDATE() ?
SYSDATE it's a Date function, it should work with a timestamp field

Also, did you tried creating another field, setting it as timestamp, default 0, and setting "NOW()" instead of passing get_systime() value?
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
killergirl
Senior Member
Join Date: Jul 2010
Old 07-19-2012 , 04:54   Re: get_systime() problem
Reply With Quote #9

Quote:
Originally Posted by meTaLiCroSS View Post
SYSDATE it's a Date function, it should work with a timestamp field

Also, did you tried creating another field, setting it as timestamp, default 0, and setting "NOW()" instead of passing get_systime() value?
Did you mean I need to remove the get_systime() from the query string and format it with NOW() query?

PHP Code:
INSERT INTO `asd` (
   
'id',
   
'timestamp'VALUES (
   
   
'',
   
'NOW()' 
This is how you say?
killergirl is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 07-19-2012 , 19:26   Re: get_systime() problem
Reply With Quote #10

Quote:
Originally Posted by killergirl View Post
Did you mean I need to remove the get_systime() from the query string and format it with NOW() query?

PHP Code:
INSERT INTO `asd` (
   
'id',
   
'timestamp'VALUES (
   
   
'',
   
'NOW()' 
This is how you say?
Yeah, but "timestamp" field should be a "timestamp field" (lol), change his properties, set as default value = 0, and for retrieving the passed value as a unixtime int (timestamp fields are formated like year-month-day hour:minute:second) use "SELECT UNIX_TIMESTAMP(timestamp) FROM shit WHERE id = 1"
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:43.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode