Opened 13 years ago

Closed 13 years ago

Last modified 10 years ago

#264 closed defect (fixed)

timestamp conversion problem

Reported by: yuri@… Owned by: perry
Priority: critical Milestone:
Component: libtrace-library Version: 3.0
Keywords: Cc:

Description

In function

uint64_t trace_get_erf_timestamp(const libtrace_packet_t *packet) {

I have these lines:

} else if (packet->trace->format->get_timeval) {

/* timeval -> timestamp */ ts = packet->trace->format->get_timeval(packet); timestamp = ((((uint64_t)ts.tv_sec) << 32) + \

(((uint64_t)ts.tv_usec * UINT_MAX)/1000000));

and these lines do not work. After the pre-processor they expand into:

timestamp = ((((uint64_t)ts.tv_sec) << 32) + (((uint64_t)ts.tv_usec *

(2147483647 * 2U + 1U))/1000000));

And the expression (2147483647 * 2U + 1U) evaluates into a signed integer -1 which produces wrong results:

(gdb) p ts

$89 = {tv_sec = 1159894600, tv_usec = 846404}

(gdb) p timestamp

$94 = 4981727820551075308

I'm using glibc-headers-2.7-2, gcc-4.1.2-33, kernel 2.6.24.3-50.fc8, libtrace-3.0.4.

I think this is pretty serious. I'm not sure why UINT_MAX gets expanded into a signed constant, which is probably a bug in itself, but using this constant here seems wrong anyway, because we know exactly how many bits we have. Besides, 1000000us should be equal to 1s, so I suggest changing this conversion to:

timestamp = ((((uint64_t)ts.tv_sec) << 32) + \

(((uint64_t)ts.tv_usec << 32) /1000000));

Change History (2)

comment:1 Changed 13 years ago by perry

  • Resolution set to fixed
  • Status changed from new to closed

Hrm, how odd. UINT_MAX on your machine appears to expand to (2147483647 * 2U + 1U) where as on our machines it expands to 4294967295U which is unsigned.

The original code was written that way to be consistent with the conversion from floating point seconds, where a bitshift of a floating point number doesn't work.

Your fix is commited in r1357.

comment:2 Changed 10 years ago by NicaTolcalt

For people prone to constipation, limiting foods that have little or no fiber, such as ice cream, cheese, meat, and processed foods, is also important. online weight loss clinic phentermine [http://www.36branding.com/what-we-do?creative-writing phentermine and memory loss - fp doctor information phentermine [http://www.panoramaphotographer.com/comparisons/web/devalvr-comparisons.html phentermine and nausea - proven reliable phentermine sites [http://www.ictadethiopia.org/research.php phentermine 37.5 overnight delivery - is phentermine phen phen [http://www.rustenvrede.com/estate-of-mind/gallery phentermine does it work - phentermine hydroxide [http://ictadethiopia.org/Proceedings/Mr.%20Moses%20Bazibu/ order phentermine with online diagnosis - phentermine no prescription required online consultation [http://www.perceptdev.com/labs/content/tin-can-new-iphone-app phentermine hcl trusted pharmacy catalog - buy scam phentermine [http://www.asiasocietysocal.org/index.php?id=409 no prescription phentermine cod - looking for diet pills called phentermines [http://www.panoramaphotographer.com/comparisons/web/panorama2flash-comparisons.html how can i buy phentermine - phentermine from mexican pharmacies [http://www.lakesalive.org/events/zircus-plus-barrow1/ phentermine mastercard no prescription - online phentermine prescriptions and pharmacies [http://www.asiasocietysocal.org/index.php?id=607 find doctor to prescribe phentermine - These changes increase the risk for dangerous ventricular arrhythmias and sudden cardiac arrest. tramadol and sexual dysfunction [http://www.lakesalive.org/mintfest-summer-school tramadol hci effects on brain - tramadol morphine dose equivalent [http://www.rustenvrede.com/winery/rust-en-vrede-1694-classification-gets-first-rating-in-wine-spectator counseling degree online tramadol - new tramadol tramadol ultram [http://www.panoramaphotographer.com/ equivalents to tramadol xl - naproxen and tramadol [http://www.asiasocietysocal.org/index.php?id=300 what is tramadol with acetaminophen - tramadol hcl capsules [http://www.treesfoundation.org/affiliates/update-122 discount tramadol for dogs - how strong is tramadol [http://www.treesfoundation.org/affiliates/specific-50 tramadol in mexican pharmacies - tramadol bruising [http://www.vetsbeyondborders.org/about-us/sponsors/marchig-animal-welfare-trust/ tramadol pain pills - plugging tramadol [http://www.panoramaphotographer.com/comparisons/web/jcpanorama-large-panorama.html tramadol fo dogs - tramadol adverse effects [http://www.vetsbeyondborders.org/news/world-rabies-day-2010/ samoobrona warszawa pl tramadol - warfarin tramadol interaction [http://www.greenhoe.com/index2.html tramadol and heroin - Clinical studies of TENORMIN did not include sufficient number of patients aged 65 and over to determine whether they respond differently from younger subjects. legal adipex [http://www.panoramaphotographer.com/comparisons/web/cuty-comparisons.html adipex causing rapid heart beat - is adipex a prescription drug [http://theabilityawards.com/awards/four-weeks-left-to-apply didrex adipex online - adipex online without prescription pharmacy online [http://www.tpsr-alliance.org/index.php?option=com_content&task=view&id=13&Itemid=27 adipex next day shipping no prescription - adipex from us online pharmacy [http://www.asiasocietysocal.org/index.php?id=252 adipex vs adipex p - It seems to sensitize tissues to the action of acetylcholine. enhancing viagra [http://www.treesfoundation.org/affiliates/specific-11 viagra uk paypal - what does viagra do to females [http://www.panoramaphotographer.com/comparisons/web/panosalado-comparisons.html safety of viagra - viagra users reviews [http://www.panoramaphotographer.com/comparisons/web/pan0-comparisons.html viagra and mexico - viagra france [http://www.rustenvrede.com/winery/three-golds-for-the-rust-en-vrede-estate viagra cialis mix - Administering Verelan® PM in the morning increased the extent of absorption of verapamil and/or decreased the metabolism to norverapamil. cialis buy on line [http://www.treesfoundation.org/affiliates/specific-35 best buy cialis softtabs - aggression and cialis [http://www.luckyswings.com/orderform.html cialis buzzmachine by jeff jarvis - cialis online fda [http://www.vetsbeyondborders.org/how-you-can-help/volunteer/ cialis dosage 20mg - sales cialis [http://www.vetsbeyondborders.org/forum/ cialis panties - after effects of cialis [http://www.lakesalive.org/events/past-events/mintfest/ jual cialis - viagra lavetra cialis [http://www.tpsr-alliance.org/index.php?option=com_content&task=view&id=18 how to write a prescription cialis - Concomitant administration of tramadol and cimetidine does not result in clinically significant changes in tramadol pharmacokinetics. soma carisoprodol tablets [http://www.rustenvrede.com/ drug abuse soma - Some encephalopathies are preventable by positive lifestyle choices and others cannot be foreseen. xanax withour a prescription [http://greenhoe.com/gallery/gary65/ xanax brand name - xanax dosage g3720 [http://www.lakesalive.org/ xanax safe with z-pack - what are signs of xanax overdose [http://www.asiasocietysocal.org/index.php?id=402 what does xanax do to the brain - cephalexin nexium and xanax together [http://www.rustenvrede.com/wines/agents-2?country=Switzerland alprazolam mg generic xanax - does xanax show up on a drug test [http://www.vetsbeyondborders.org/about-us/sponsors/cenvet-australia/ dosages of xanax - xanax mexican drug class [http://theabilityawards.com/case-studies drug abuse of xanax - People traveling in areas endemic with Falciparum should take other medications prescribed by a doctor (not for pregnant women or children younger than 8 years). effects of valium and alcohol [http://www.panoramaphotographer.com/comparisons/web/tourweaver-panorama-comparisons.html taking valium while pregnant - valium no prescription overnight [http://www.asiasocietysocal.org/index.php?id=555 valium for dental work - symptoms of valium withdrawal [http://www.36branding.com/category/nonprofit safe dose of valium - Examination of the jugular veins in the neck and swelling or fluid in the feet and ankles can be clues to the diagnosis of heart failure.

Note: See TracTickets for help on using tickets.