org_value = (int) (exp(stored_value / constant) + 0.5)
Factor: 125
OrgValue Stored ConvertedBackValue
1 0 1
2 87 2
5 201 5
10 288 10
100 576 100
500 777 501
800 836 803
1000 863 996
10000 1151 9977
50000 1352 49811
100000 1439 99907
500000 1640 498820
1.00E+06 1727 1000490
1.00E+07 2015 10019062
By using 88 as factor, 1e10 ms (which is 116 days) can be stored while 50s results in an inaccuracy of only 80 ms. See the table below.
Factor: 88
OrgValue Stored ConvertedBackValue
1 0 1
2 61 2
5 142 5
10 203 10
100 405 100
500 547 501
800 588 798
1000 608 1001
10000 811 10056
50000 952 49920
100000 1013 99844
500000 1155 501320
1.00E+06 1216 1002675
1.00E+07 1418 9955506
1.00E+08 1621 99977383
1.00E+09 1824 1004014929
1.00E+10 2026 9968812163