You can just use the .length property of a media item. ie, playlist(3).length
set mi = loaditem("C:\song.mp3")
or wherever else you obtain a media item. Im not sure if works perfectly if the item isn't in your ML, but hopefully it will.
Be warned that the length is often wrong. This will be the case regardless of whether you are using this plugin or not. Even winamp displays the wrong time sometimes and the 'time remaining' display just works in over time as it tries to catch up. I have no idea why this error occurs, something to do with the .mp3 format and difficulty in getting an accurate time I suppose.
The other way is to poll winamp for the length and time elapsed etc, it tends to get more accurate the longer the item is played. You probaly wont find an elegant solution to what you are trying to do, no-one else has.
Use this with SendMsg. ie:
#define IPC_GETOUTPUTTIME 105
/* int res = SendMessage(hwnd_winamp,WM_WA_IPC,mode,IPC_GETOUTPUTTIME);
** returns the position in milliseconds of the current track (mode = 0),
** or the track length, in seconds (mode = 1). Returns -1 if not playing or error.
length = SendMsg(1024, 1, 105)