emiliano Posted March 16, 2003 Share Posted March 16, 2003 hello everybody.. i need some help from mysql gurus.. i'm trying to create a site to show rally car racing.. the problem is that i need to show fraction of second, and mysql doesn't support it yet.. (they said in the manual that they are going to support it.. only god knows when..) someone have some solution to this..? another field isnt a solution.. cheers emiliano patagonia, argentina Link to comment Share on other sites More sharing options...
Christian Lescuyer Posted March 16, 2003 Share Posted March 16, 2003 someone have some solution to this..? int(11) Count milliseconds from race start. Christian Lescuyer Link to comment Share on other sites More sharing options...
emiliano Posted March 17, 2003 Author Share Posted March 17, 2003 the problem is that i have 2 field.. in one table i have a field where i put the time when the car started to run.. then in another table i have another field where i put the time where it finished... eg start 14:00:00 pm finish 14:05:03.6 which means that the car took 5 min 3 seconds and 6 decimals of second.. your solution will require a intermediate pass to pass from the finished time to an int... or not? thanks anyway emiliano patagonia, argentina Link to comment Share on other sites More sharing options...
Christian Lescuyer Posted March 17, 2003 Share Posted March 17, 2003 Yes. Considering you don't have fractions of seconds in the database TIME field, you have to do it some other way. So I propose milliseconds (one thousandth of a second) units. You'll have a good precision. If you enter the time as hh:mm:ss:dd, you can convert the hh:mm:ss part with mktime(), multiply by 1000, and add the dd part times 100. To get a time difference, substract start from finish (well, of course :oops:). To display, convert the other way: divide by 1000 and apply time(), etc. Christian Lescuyer Link to comment Share on other sites More sharing options...
emiliano Posted March 17, 2003 Author Share Posted March 17, 2003 i will try that! THANKS cheers emiliano patagonia, argentina Link to comment Share on other sites More sharing options...
emiliano Posted March 17, 2003 Author Share Posted March 17, 2003 i'm back :) i create a field called start_time int and another one called finish_time int i only work with 1/10 sec.. so i insert 1269 if i want 2 minute 6 seconds and 9/10 sec.. i use time() to format my field, also i have to divide the field by 10, and use the floor() function to get rid of the decimals.. but the problem is, how to show the decimals only! i hope you do! cheers emiliano patagonia, argentina Link to comment Share on other sites More sharing options...
Christian Lescuyer Posted March 18, 2003 Share Posted March 18, 2003 Modulo operator $tenth = $time % 10; Christian Lescuyer Link to comment Share on other sites More sharing options...
emiliano Posted March 19, 2003 Author Share Posted March 19, 2003 hi.. i think that you didn't understand me.. but don't worry actually i have a really good thing to start.. now everything works.. it's time to code stilization (that's is a word?).. patagonia, argentina Link to comment Share on other sites More sharing options...
Christian Lescuyer Posted March 19, 2003 Share Posted March 19, 2003 it's time to code stilization (that's is a word?).. :shock: I'm not sure :D Christian Lescuyer Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.