OSDN Git Service

2019/04/13(Sat) 07:01
[drdeamon64/drdeamon64.git] / libbrownie / drd64_libbrownie_error.c
index d7777b2..58960f2 100644 (file)
@@ -65,11 +65,13 @@ int
        char    *pstr_errptn    = NULL;
        char    *pstr_module    = NULL;
        char    *pstr_arch              = NULL;
+       char    str_time[64];
        DWord   dw_tmp;
        DWord   dw_errlv1;
        DWord   dw_errlv2;
        DWord   dw_srcid;
        DWord   dw_funcid;
+       struct  tm      t_tm;
        
        Drd64_ErrorInfo         *p_errinfo;
 
@@ -78,7 +80,11 @@ int
 
        if( 0x00 == p_errinfo->dw_error )       { return 0x00; }
 
-       printf("[ErrorInfo] %2d ------------------------------------------------------------------\n", i_id );
+       localtime_r( (const time_t *)&(p_errinfo->t_time.tv_sec), &t_tm );
+       strftime( str_time, 64, "%Y/%m/%d(%a) %T", &t_tm );
+
+       printf("[ErrorInfo] %2d --------------------------------- %s.%03lu.%03lu\n",
+                               i_id, str_time, (p_errinfo->t_time.tv_usec / 1000), (p_errinfo->t_time.tv_usec % 1000) );
        printf("  ErrCode : %08x h\n", p_errinfo->dw_error );
 
        dw_tmp  = DRD64_ERROR_TYPE( p_errinfo->dw_error );
@@ -269,6 +275,7 @@ int
        p_errinfo->i_srcline            = i_srcline;
        p_errinfo->qw_value[0]          = qw_value1;
        p_errinfo->qw_value[1]          = qw_value2;
+       gettimeofday( &(p_errinfo->t_time), NULL );
 
        return 0x00;
 }
@@ -299,6 +306,20 @@ Drd64_ErrorInfo *
 
 /*----------------------------------------------------------------------
 ----------------------------------------------------------------------*/
+LIBBROWNIE_FUNC
+void
+       LibBrownie_Error_ClearErrorInfo(
+               void )
+{
+       if( NULL != gp_errorinfo )
+               { memset( gp_errorinfo, 0x00, sizeof( Drd64_ErrorInfo ) * gi_max_errorinfo ); }
+
+       return;
+}
+
+
+/*----------------------------------------------------------------------
+----------------------------------------------------------------------*/
 LIBBROWNIE_ERROR_EXTERN
 int
        LibBrownie_Error_InitErrorSystem(