Why not to use UDF ?
#include <mysql/mysql.h>
#include <sys/time.h>
my_bool hrtime_init(UDF_INIT *initid,UDF_ARGS *args, char *message) {
return 0;
}
void hrtime_deinit(UDF_INIT *initid) {}
double hrtime(UDF_INIT *initid, UDF_ARGS *args, char *result, unsigned
long *le
ngth, char *is_null, char *error) {
struct timeval tv;
gettimeofday(&tv,NULL);
return ((double)tv.tv_usec)/1000000+tv.tv_sec;
}
oompile it:
gcc -shared -o hrtime.so hrtime.c
and install:
CREATE FUNCTION hrtime RETURNS REAL SONAME 'hrtime.so'
bwillits@stripped wrote:
> Sorry:
>
> Language: MySQL native function (for use in a stored proc)
> OS: Linux (CentOS)
>
> thanks,
> BW
>
> ---- Rick James <rjames@stripped> wrote:
>
>>Language? OS?
>>
>>Perl has HiRes::Timer
>>PHP has microtimes
>>Windows has QueryPerformanceTimer
>>Java has something
>>
>>
>>>If the answer is no, can you point me to the code for now()
>>>or similar so I could investigate adding such a function?
>>
>
>