How to plug HH:MM:SS data into a time wave through a user function.

Ok so Ive been reading thru the helpfiles and the forum and am getting nowhere on this.

I have data that gives a time: 12:34:45 for example. I would like to load this into a wave. With the semi-colons, I have a string (as far as I can tell). Obviously I cant dump this into a wave containing numerical variables, while a text wave will take it easy enough. But if I manually type a time in this format into a table, I can see the new wave has the type 'DP' and not 'text'. There is no information in the help file for 'make' or 'wave type' for this specific type, DP!!, so I cant just reformat the type from a text wave.

Looking through the various help files on 'time' etc... doesn't get me much further. date2secs and time2secs give me a string function so I am just back to square one there. Also have to deal with figuring out how many seconds it has been since 1904 and comparing the date in my timestamp to that etc... (??!) I feel like this must be the wrong tree to go barking up.

So yeah, help greatly appreciated.

EDIT:
Browsing the wave and trying to change its format through the popup menu with this command doesn't actually change anything:
ModifyTable format(test_wave)=7


I can set the scale with this command:
SetScale/P x 0,1,"dat", test_wave
And it now shows up with the correct format, but the wave type is still text. Does that matter??

OK..."DP" is just double point. Feel stupid now. That said, I cant redimension a text wave into DP, even if all it contains is the above format. I also cant use str2num, because it just stops at the damned colon, so "12:23:35" becomes 12. Wow this is frustrating =D


SOLUTION:

Make a double point wave. Convert the time to number of seconds by HH*60*60 + MM*60 + SS. Input the values. Set the scale to "dat" with this command: SetScale d 0,0,"dat", wave_name. Set the format to time with this command: ModifyTable format(wave_name)=7

Am I missing anything? This seems to work..
Hm. There is no function time2secs... But it's not hard to write one:
Function timeStringToSecs(timestr)
    String timestr
   
    Variable Seconds=0
   
    Seconds += str2num(StringFromList(0, timestr, ":"))*3600
    Seconds += str2num(StringFromList(1, timestr, ":"))*60
    Seconds += str2num(StringFromList(2, timestr, ":"))
   
    return Seconds
end

If you have a wave full of time strings, then you can make a new numeric wave with seconds like this:

Make/N=(numpnts(TextWaveWithTime))/D NumericaWaveWithSeconds = timeStringToSecs(TextWaveWithTime)

You can set the table format to "time" to display numbers as times. That doesn't change the numbers themselves, it just displays the numbers in a different format.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com