# Time variable rounding

**URL:** <https://verificationacademy.com/forums/t/time-variable-rounding/37147>\
**Category:** SystemVerilog\
**Tags:** rounding, systemverilog-uvm, SystemVerilog, realtime, time\
**Created:** [February 7, 2020, 12:46pm UTC](https://verificationacademy.com/forums/t/time-variable-rounding/37147 "2020-02-07T12:46:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nrllhclb](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/n/df788c/32.png) [@nrllhclb](https://verificationacademy.com/forums/u/nrllhclb)\
**Post date:** [February 7, 2020, 12:46pm UTC](https://verificationacademy.com/forums/t/time-variable-rounding/37147/1 "2020-02-07T12:46:50Z")

</div>

Hello everyone,  
I wrote code which includes time variables,  
but when i displayed this variable, it has been rounding a higher number.  
how do i prevent that?

Thanks for your answers.

**class** …;

**const realtime** tclk\_half = 31250ps;  
///////////////////////////////////////////////  
**build\_phase** ;  
$timeformat(-12,0,“ps”,8);  
///////////////////////////////////////////////  
**run\_phase** ;  
`uvm\_info(get\_type\_name(),$sformat(“time : %t”,tclk\_half), UVM\_LOW)

**_Output_** :  
time : 31300ps

---

<div class="post-metadata">

**Author:** ![Rahulkumar2](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/rahulkumar2/32/3675_2.png) [@Rahulkumar2](https://verificationacademy.com/forums/u/Rahulkumar2)\
**Post date:** [February 7, 2020, 1:27pm UTC](https://verificationacademy.com/forums/t/time-variable-rounding/37147/2 "2020-02-07T13:27:14Z")

</div>

_In reply to [nrllhclb](https://verificationacademy.com/forums/t/time-variable-rounding/37147):_

Check timescale value. Precision should be ps.

```verilog

`timescale 1ns/1ps

```

---

<div class="post-metadata">

**Author:** ![nrllhclb](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/n/df788c/32.png) [@nrllhclb](https://verificationacademy.com/forums/u/nrllhclb)\
**Post date:** [February 7, 2020, 2:27pm UTC](https://verificationacademy.com/forums/t/time-variable-rounding/37147/3 "2020-02-07T14:27:42Z")

</div>

_In reply to [Rahulkumar](https://verificationacademy.com/forums/t/time-variable-rounding/37147/2):_

thank you for the answer, it works.
