Changeset de060a8


Ignore:
Timestamp:
05/18/18 11:39:59 (2 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
cachetimestamps, develop, etsilive, master, rc-4.0.4, ringdecrementfix, ringperformance
Children:
9845e97
Parents:
0e2bdde
git-author:
Shane Alcock <salcock@…> (05/18/18 11:36:01)
git-committer:
Shane Alcock <salcock@…> (05/18/18 11:39:59)
Message:

Avoid integer division in trace_event_trace()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_helper.c

    rcc9c9de rde060a8  
    185185
    186186       
    187         if (fabs(trace->event.first_now)>1e-9) {
     187        if (fabs(trace->event.first_ts)>1e-9) {
    188188                /* Subtract the tdelta from the starting times to get a suitable
    189189                 * "relative" time */
     
    193193                /* If the trace timestamp is still in the future, return a
    194194                 * SLEEP event, otherwise return the packet */
    195                 if (sincebeginnow <= sincebegintrace / trace->replayspeedup) {
    196                         event.seconds = ((sincebegintrace / trace->replayspeedup) - sincebeginnow);
     195                if (sincebeginnow <= sincebegintrace / (double)trace->replayspeedup) {
     196                        event.seconds = ((sincebegintrace / (double)trace->replayspeedup) - sincebeginnow);
    197197                        event.type = TRACE_EVENT_SLEEP;
    198198                        trace->event.waiting = true;
     
    206206                 * trace file.
    207207                 */
    208                 trace->event.first_now = now;
    209                 trace->event.first_ts = ts;
     208                trace->event.first_now = (double)now;
     209                trace->event.first_ts = (double)ts;
    210210        }
    211211
Note: See TracChangeset for help on using the changeset viewer.