If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > NOW() with milliseconds?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-21-07, 10:27
japhy1 japhy1 is offline
Registered User
 
Join Date: Nov 2004
Posts: 16
NOW() with milliseconds?

Is there any function within MySQL that can return the current time with millisecond resolution. NOW() only returns the integer number of seconds...

Thanks in advance.
Reply With Quote
  #2 (permalink)  
Old 08-21-07, 10:58
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Would this help?
__________________
George
Twitter | Blog

Last edited by gvee; 08-21-07 at 11:06. Reason: "Would" doesn't have a Q
Reply With Quote
  #3 (permalink)  
Old 08-21-07, 11:04
japhy1 japhy1 is offline
Registered User
 
Join Date: Nov 2004
Posts: 16
i don't think so, it says you can return the milliseconds from an argument but there's nothing related to NOW() or CURTIME() with finer resolution than seconds

I'm looking at this right now for help.

http://bugs.mysql.com/bug.php?id=8523
Reply With Quote
  #4 (permalink)  
Old 08-21-07, 11:11
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
__________________
George
Twitter | Blog
Reply With Quote
  #5 (permalink)  
Old 08-21-07, 11:18
japhy1 japhy1 is offline
Registered User
 
Join Date: Nov 2004
Posts: 16
not using postgresql or oracle.

what the best way to compile and use a UDF on a windows platform?
Reply With Quote
  #6 (permalink)  
Old 08-21-07, 11:22
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Quote:
Originally Posted by The link I posted

MySQL

It turns out that MySQL does not support sub-second time or date formats. There is a MICROSECOND function in MySQL allowed to run on temporal values, but sub-second precision (including millisecond) is not stored in the database.
The message I have entered is too short...
__________________
George
Twitter | Blog
Reply With Quote
  #7 (permalink)  
Old 08-21-07, 14:24
japhy1 japhy1 is offline
Registered User
 
Join Date: Nov 2004
Posts: 16
not sure what the point of your last reply was...

anyway, I found a method. I created a dll using Visual C++ .NET 2005. I then turned the dll into a UDF...all the UDF did was get the current system time's millisecond value using the C++ SYSTEMTIME structure. I then added this to the number of seconds you can get using the UNIX_TIMESTAMP and NOW() functions in SQL. Store it as a DOUBLE PRECISION and voila you've got a current UTC time with millisecond resolution.

relevant link:

http://www.codeguru.com/cpp/data/mfc...p/c12615/#more
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On