Logo Search packages:      
Sourcecode: libnl version File versions  Download package

double nl_cancel_down_bytes ( unsigned long long  l,
char **  unit 
)

Cancel down a byte counter

  • l byte counter
  • unit destination unit pointer
Cancels down a byte counter until it reaches a reasonable unit. The chosen unit is assigned to unit.

Returns:
The cancelled down byte counter in the new unit.

Definition at line 102 of file utils.c.

{
      if (l >= 1099511627776LL) {
            *unit = "TiB";
            return ((double) l) / 1099511627776LL;
      } else if (l >= 1073741824) {
            *unit = "GiB";
            return ((double) l) / 1073741824;
      } else if (l >= 1048576) {
            *unit = "MiB";
            return ((double) l) / 1048576;
      } else if (l >= 1024) {
            *unit = "KiB";
            return ((double) l) / 1024;
      } else {
            *unit = "B";
            return (double) l;
      }
}


Generated by  Doxygen 1.6.0   Back to index