high resolution time stamps for waves

I took a quick look into what one could do about high resolution time stamps for waves when the issue was mentioned on the mailing list in November 2018. Apparently this is not so easy a subject if one needs cross-platform portability. 

Look here for a reference: <https://stackoverflow.com/questions/361363/how-to-measure-time-in-milli…;

It's only tangential to my own interests, so I coded a simple solution for MacOSX with XOP Toolkit 8.01 and left it at that. Contact me directly if you need further details. I used XFUNC1 as a template which ships with the toolkit. A code snippet:

#include <sys/time.h>

#define BUFFERSIZE 256

static void
DateTimeStr(char *aDateTime)
{
    time_t Systime;
    struct tm *theTime;
    struct timeval time_prec;
    char ms[BUFFERSIZE];
    
    Systime=time(NULL);
    theTime=localtime(&Systime);
    gettimeofday(&time_prec,NULL);
    
    strftime(aDateTime,BUFFERSIZE-1,"%a, %d %b, %Y %T",theTime);
    strcat(aDateTime,".");
    sprintf(ms,"%06lld",(SInt64)(time_prec.tv_usec));
    strcat(aDateTime,ms);

    return;
}

In the calling function:

    char buffer[BUFFERSIZE];
    char noteText[BUFFERSIZE];
 

    DateTimeStr(buffer);
    sprintf(noteText,"time stamp added ---> %s",buffer);
 

Now use code such as in the XOP Toolkit Manual, version 8.01, under "Handle Example" on page 196, to convert this to a handle and set a wave note.