Conversion from where? What is the source of the time? The source of the time will dictate how you would convert the time into SDIF or HY3 format.
I’ve always felt it is easier to manage time in seconds as a floating point number. Converting from seconds to a HH:MM:SS.dd is pretty easy if your source value is always in seconds. It also makes sorting values in a database much easier because you can do true numeric sort.
Depending on what you want to do, I may have something for you.
I wrote a WordPress plugin which supports managing a swim team. In addition to all of the stuff needed to manage the swimmers in the context of WordPress, it can generate SDIF and Hy-tek files for entries, rosters, and some other stuff. You can find the source here:
https://sourceforge.net/projects/wp-swimteam/
I also did some work on a results database that I never finished but it does have a bunch of SDIF import and export code written in PHP which you are welcome to. You can find that here:
https://github.com/mpwalsh8/flip-turn/tree/master/webapps/flip-turn
Mike
--
You received this message because you are subscribed to the Google Groups "SDIF Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sdif-forum+...@googlegroups.com.
To post to this group, send email to sdif-...@googlegroups.com.
Visit this group at https://groups.google.com/group/sdif-forum.
For more options, visit https://groups.google.com/d/optout.
Sorry for the misdirection, I should read these closer.
While I have not personally used the ST2 format myself, in looking at Troy’s PDF, it looks like he has everything you need to construct a record. The input time is a single precision floating point number which would almost certainly mean it is in seconds with the tenths/hundredths after the decimal point. Storing a time for a race (or swim meet) is different than storing a time of day.
So for your original examples, 1:12.69 would be 72.69 as a floating point number then you would convert it to the ST2 format using the algorithm Troy documented.
Troy added some detail about the floating point conversion back in 2012 in a discussion here: https://groups.google.com/forum/#!topic/sdif-forum/l0gWNCwjENE
Mike
From: sdif-...@googlegroups.com [mailto:sdif-...@googlegroups.com] On Behalf Of Robbert van Andel
Sent: Sunday, February 07, 2016 2:55 PM
To: SDIF Forum <sdif-...@googlegroups.com>
--
private function formatTime($time1) {
//$time should be float
$time = floatval($time1);
$time = $time + 2;
//Process byte 4 (which is the exponent)
//Mask out everything else
$byte4 = $time & bindec('01111111100000000000000000000000');
//Move to first 8 bits
$byte4 >>= 23;
//Multiple by 2
$byte4 <<= 1;
//$byte4 should be correct at this stage (but double check)
//Process byte 3 (this includes add "0" to bit 8)
$byte3 = $time & bindec('00000000011111110000000000000000');
$byte3 >>= 16;
//Process byte 2
$byte2 = $time & bindec('00000000000000001111111100000000');
$byte2 >>= 8;
//Process byte 1
$byte1 = $time & bindec('00000000000000000000000011111111');
//Put them together in correct order
$hytek = 0;
$hytek = $byte4 | ($byte3 << 8) | ($byte2 << 16) | ($byte1 << 24);
return pack('f',$hytek);
}
--
You received this message because you are subscribed to a topic in the Google Groups "SDIF Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sdif-forum/nDBGxVWCOLM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sdif-forum+...@googlegroups.com.
Thanks Troy. So far I have had no luck making this work. Interestingly, when I generated an ST2 file from Meet Manager, I was not able to reverse engineer the file using the formating in your documentation. I wonder if they've changed the format in the last 3 years or so.