Sangeeta
Sangeeta

Reputation: 599

Storing output of System.currentTimeMillis() in mysql

I am using System.currentTimeMillis(); funtion in java to compute time taken by a program. I have to run my program for 10 iterations and report the average results. If I store the output of System.currentTimeMillis(); function as double will it be acceptable.

Upvotes: 2

Views: 1554

Answers (1)

Juned Ahsan
Juned Ahsan

Reputation: 68715

System.currentTimeMillis() returns a long, which requires 8 bytes. And if you want to store that value in mysql then equivalent will be BIGINT, which is also 8 bytes.

References:

Java

https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html

MySQL

http://dev.mysql.com/doc/refman/5.7/en/integer-types.html

Computed average maybe a decimal value and hence only average needs to be of type double.

Upvotes: 4

Related Questions