summaryrefslogtreecommitdiffstats
path: root/tc/tc_core.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2007-03-04 20:14:59 +0100
committerStephen Hemminger <shemminger@linux-foundation.org>2007-03-13 14:42:16 -0700
commitf0bda7e5a52d880a85af698a041afa7dc379e76e (patch)
treee081436da0d22088f95913aa4873f082e5b273f4 /tc/tc_core.c
parent76dc0aa28fe6fa78e263bf0250c1e42c584dd544 (diff)
Introduce TIME_UNITS_PER_SEC to represent internal clock resolution
[IPROUTE]: Introduce TIME_UNITS_PER_SEC to represent internal clock resolution Introduce TIME_UNITS_PER_SEC and conversion functions between internal resolution and resolution expected by the kernel (currently implemented as NOPs, only needed by HFSC, which currently always uses microseconds). Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Diffstat (limited to 'tc/tc_core.c')
-rw-r--r--tc/tc_core.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/tc/tc_core.c b/tc/tc_core.c
index 1ca45836..07dc4ba1 100644
--- a/tc/tc_core.c
+++ b/tc/tc_core.c
@@ -46,14 +46,24 @@ long tc_core_tick2usec(long tick)
return tick/tick_in_usec;
}
+long tc_core_time2ktime(long time)
+{
+ return time;
+}
+
+long tc_core_ktime2time(long ktime)
+{
+ return ktime;
+}
+
unsigned tc_calc_xmittime(unsigned rate, unsigned size)
{
- return tc_core_usec2tick(1000000*((double)size/rate));
+ return tc_core_usec2tick(TIME_UNITS_PER_SEC*((double)size/rate));
}
unsigned tc_calc_xmitsize(unsigned rate, unsigned ticks)
{
- return ((double)rate*tc_core_tick2usec(ticks))/1000000;
+ return ((double)rate*tc_core_tick2usec(ticks))/TIME_UNITS_PER_SEC;
}
/*