new_time = fromtime * 1000; -- here is line 19
An integer times an integer results in an integer. Period. Neither fromtime nor new_time have been assigned to yet, the in-memory result of the computation is only allocated integer bits and if you overflow that you get an error. If there is no error the result of that computation is stored in new_time. Since new_time is a bigint during assignment the in-memory integer is implicitly converted to bigint to match the assignment type.
Either fromtime or the 1000 need to be declared as bigint if you want the computation type to be bigint as well, and thus avoid the overflow. The implicit cast to store into new_time goes away. And whichever, if any, of the two values you do not change to bigint gets implicitly cast to bigint in order for the multiplication operator to match “*(bigint,bigint)”.
David J.