Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The constant Build.TIME in Android SDK

Tags:

android

sdk

What exactly the constant "long android.os.Build.TIME" means?

I tested in my device and I get a strange number which I do not know the meaning.

In http://developer.android.com/reference/android/os/Build.html, it is not explained.

like image 800
Breno Macena Avatar asked Oct 21 '25 02:10

Breno Macena


1 Answers

As @CommonsWare correctly commented: it's a Unix epoch timestamp (in milliseconds) of when the device's ROM was built.

If you dig into the source of the Build class, you'll find the following:

// The following properties only make sense for internal engineering builds.
public static final long TIME = getLong("ro.build.date.utc") * 1000;

In other words: the value is simply read from the ro.build.date.utc system property, which is part of the ROM's build.prop, which on its turn gets generated by buildinfo.sh.

The more human-friendly equivalent is ro.build.date, which contains a textual date representation of the same value. For example, in build.prop you may find:

ro.build.date=Tue Nov 6 13:10:27 CST 2012
ro.build.date.utc=1352229027

There is no associated constant for it in Android's public API, but you could easily retrieve it by calling SystemProperties.get("ro.build.date").

That being said, unless you develop for specific ROMs and/or are a ROM developer, you shouldn't really have to care about these values, as the comment in the first code snippet also points out.

like image 73
MH. Avatar answered Oct 23 '25 15:10

MH.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!