
#include "fsutil.h"

wcc_data
fsutil::make_wcc(fattr3 before, fattr3 after)
{
  wcc_data d;

#if 0
  // because there's no locking, we cannot guarantee that
  // there were no changes between the before and after
  // attributes. so don't send any. XXX
  d.before.set_present(false);
  d.after.set_present(false);
#else
  d.before.set_present(true);
  d.before.attributes->size = before.size;
  d.before.attributes->mtime = before.mtime;
  d.before.attributes->ctime = before.ctime;
  d.after.set_present(true);
  (*d.after.attributes) = after;
#endif

  return d;
}

// return the current time in NFS format
nfstime3
fsutil::nfstime()
{
  struct timeval tv;
  gettimeofday(&tv, (struct timezone *) 0);
  nfstime3 t;
  t.seconds = tv.tv_sec;
  t.nseconds = tv.tv_usec * 1000;
  return t;
}
