mirror of
https://github.com/Hamlib/Hamlib.git
synced 2024-09-21 18:37:18 +00:00
astyle debug.c
This commit is contained in:
parent
ba712ce904
commit
8dae7db02c
21
src/debug.c
21
src/debug.c
@ -140,18 +140,18 @@ void HAMLIB_API rig_set_debug_time_stamp(int flag)
|
||||
}
|
||||
|
||||
|
||||
char *date_strget(char *buf,int buflen)
|
||||
char *date_strget(char *buf, int buflen)
|
||||
{
|
||||
time_t mytime;
|
||||
struct tm *mytm;
|
||||
struct timeval tv;
|
||||
mytime=time(NULL);
|
||||
mytime = time(NULL);
|
||||
mytm = gmtime(&mytime);
|
||||
gettimeofday(&tv,NULL);
|
||||
strftime(buf,buflen,"%Y-%m-%d:%H:%M:%S.",mytm);
|
||||
gettimeofday(&tv, NULL);
|
||||
strftime(buf, buflen, "%Y-%m-%d:%H:%M:%S.", mytm);
|
||||
char tmp[16];
|
||||
sprintf(tmp,"%06ld",(long)tv.tv_usec);
|
||||
strcat(buf,tmp);
|
||||
sprintf(tmp, "%06ld", (long)tv.tv_usec);
|
||||
strcat(buf, tmp);
|
||||
return buf;
|
||||
}
|
||||
|
||||
@ -183,10 +183,13 @@ void HAMLIB_API rig_debug(enum rig_debug_level_e debug_level,
|
||||
{
|
||||
rig_debug_stream = stderr;
|
||||
}
|
||||
if (rig_debug_time_stamp) {
|
||||
|
||||
if (rig_debug_time_stamp)
|
||||
{
|
||||
char buf[256];
|
||||
fprintf(rig_debug_stream,"%s: ",date_strget(buf,sizeof(buf)));
|
||||
fprintf(rig_debug_stream, "%s: ", date_strget(buf, sizeof(buf)));
|
||||
}
|
||||
|
||||
vfprintf(rig_debug_stream, fmt, ap);
|
||||
fflush(rig_debug_stream);
|
||||
}
|
||||
@ -281,7 +284,7 @@ vprintf_cb_t HAMLIB_API rig_set_debug_callback(vprintf_cb_t cb, rig_ptr_t arg)
|
||||
* \brief change stderr to some different output
|
||||
* \param stream The stream to set output to
|
||||
*/
|
||||
FILE * HAMLIB_API rig_set_debug_file(FILE *stream)
|
||||
FILE *HAMLIB_API rig_set_debug_file(FILE *stream)
|
||||
{
|
||||
FILE *prev_stream = rig_debug_stream;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user