*
* (c) 2001--2006 Robert Spalek <robert@ucw.cz>
* (c) 2003--2006 Martin Mares <mj@ucw.cz>
+ * (c) 2019 Pavel Charvat <pchar@ucw.cz>
*
* This software may be freely distributed and used according to the terms
* of the GNU Lesser General Public License.
struct unit {
uint name; // one-letter name of the unit
- uint num, den; // fraction
+ uint den; // fraction
+ u64 num;
};
static const struct unit units[] = {
- { 'd', 86400, 1 },
- { 'h', 3600, 1 },
- { 'k', 1000, 1 },
- { 'm', 1000000, 1 },
- { 'g', 1000000000, 1 },
- { 'K', 1024, 1 },
- { 'M', 1048576, 1 },
- { 'G', 1073741824, 1 },
- { '%', 1, 100 },
+ { 'd', 1, 86400 },
+ { 'h', 1, 3600 },
+ { 'k', 1, 1000 },
+ { 'm', 1, 1000000 },
+ { 'g', 1, 1000000000 },
+ { 't', 1, 1000000000000LLU },
+ { 'K', 1, 1<<10 },
+ { 'M', 1, 1<<20 },
+ { 'G', 1, 1<<30 },
+ { 'T', 1, 1LLU<<40 },
+ { '%', 100, 1 },
{ 0, 0, 0 }
};
d=86400 k=1000 K=1024
h=3600 m=1000000 M=1048576
%=0.01 g=1000000000 G=1073741824
+ t=1000000000000 T=1099511627776
Attributes of a section or a list node can be set in two ways. First,
you can write the name of the section or list, open a bracket, and then
*
* (c) 2005--2007 Martin Mares <mj@ucw.cz>
* (c) 2005 Tomas Valla <tom@ucw.cz>
- * (c) 2008 Pavel Charvat <pchar@ucw.cz>
+ * (c) 2008--2019 Pavel Charvat <pchar@ucw.cz>
*
* This software may be freely distributed and used according to the terms
* of the GNU Lesser General Public License.
sprintf(buf, "%dM", (int)(x/(1<<20)));
else if (x < (u64)10<<30)
sprintf(buf, "%.1fG", (double)x/(1<<30));
+ else if (x < (u64)1<<40)
+ sprintf(buf, "%dG", (int)x/(1<<30));
+ else if (x < (u64)10<<40)
+ sprintf(buf, "%.1fT", (double)x/((u64)1<<40));
else if (x != ~(u64)0)
- sprintf(buf, "%dG", (int)(x/(1<<30)));
+ sprintf(buf, "%dT", (int)(x/((u64)1<<40)));
else
strcpy(buf, "unknown");
}