Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 449c4bab984d13ed493aa848009c797e0f498c8d3a03ea15fe72b4f45255cc21
Ticket: fb4a0a66752423622d38c070f89ad81e3b4c2bb8
signed integer overflow in TclpGetClicks()
User & Date: chrstphrchvz on 2022-02-17 00:58:35
Changes

  1. comment changed to:
    Except for maybe 35 minutes before and after the epoch, there is always signed integer overflow in <tt>TclpGetClicks()</tt> implementations when <tt>long</tt> is 32-bit:
    
    <blockquote><pre>
    % clock clicks
    <span style="font-weight:bold">tcl/unix/tclUnixTime.c:152:19:<span style="color:red"> runtime error: </span>signed integer overflow: 1645057584 * 1000000 cannot be represented in type 'long int'</span>
    3505507099
    </pre></blockquote>
    
    The attached patch should avoid this, however I have only tested the case for Unix with <tt>gettimeofday()</tt>, and not the cases for Unix without <tt>gettimeofday()</tt> nor Windows without <tt>NativeGetMicroseconds()</tt>.
    
  2. login: "chrstphrchvz"
  3. mimetype: "text/plain"