Changeset 219 for trunk/lib


Ignore:
Timestamp:
03/31/11 00:29:09 (14 years ago)
Author:
tim
Message:

updated time conversion to return a double for more precision
added modified attribute to keys to obtain user friendly time value
added accessor for key classnames
converted data attributes to functions to make workload more explicit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/regfi.c

    r215 r219  
    36493649 converts this to real GMT.
    36503650****************************************************************************/
    3651 time_t regfi_nt2unix_time(const REGFI_NTTIME* nt)
    3652 {
    3653   double d;
    3654   time_t ret;
     3651double regfi_nt2unix_time(const REGFI_NTTIME* nt)
     3652{
     3653  double ret_val;
     3654
    36553655  /* The next two lines are a fix needed for the
    36563656     broken SCO compiler. JRA. */
     
    36613661    return(0);
    36623662 
    3663   d = ((double)nt->high)*4.0*(double)(1<<30);
    3664   d += (nt->low&0xFFF00000);
    3665   d *= 1.0e-7;
     3663  ret_val = ((double)nt->high)*4.0*(double)(1<<30);
     3664  ret_val += nt->low;
     3665  ret_val *= 1.0e-7;
    36663666 
    36673667  /* now adjust by 369 years to make the secs since 1970 */
    3668   d -= TIME_FIXUP_CONSTANT;
    3669  
    3670   if (d <= l_time_min)
     3668  ret_val -= TIME_FIXUP_CONSTANT;
     3669 
     3670  /* XXX: should these sanity checks be removed? */
     3671  if (ret_val <= l_time_min)
    36713672    return (l_time_min);
    36723673 
    3673   if (d >= l_time_max)
     3674  if (ret_val >= l_time_max)
    36743675    return (l_time_max);
    3675  
    3676   ret = (time_t)(d+0.5);
    36773676 
    36783677  /* this takes us from kludge-GMT to real GMT */
     
    36863685  */
    36873686
    3688   return(ret);
     3687  return ret_val;
    36893688}
    36903689
Note: See TracChangeset for help on using the changeset viewer.