Assume a given variable, it is containing a UNIX
time-stamp, but whether it is in seconds or milliseconds format is unknown, I want to assign to a variable which i
At the risk of attracting downvotes, I want to go on record as saying DON'T DO IT.
Making assumptions about the units of a physical quantity is a terrible idea - it led to the destruction of the Mars Meteorological Orbiter (the calculated units of thrust were in pounds, the engines expected Newtons. Not enough thrust - and the orbiter burnt up in the atmosphere).
If you have a pretty good idea of the magnitude of a number, you ought to be able to make an "educated guess" at the units. For example, if I tell you my weight is 230, you could look at me and think "I bet that is pounds, not kilos". Similarly, if you convert a time stamp of my birthday to a date on the assumption it was in seconds, and it turns out to be 200 years in the future, you can reasonably assume that "seconds" was the wrong unit.
But it is a DANGEROUS thing to do.
Still - if you have to do it, then in general, I would recommend the following approach:
That last thing is important - it will allow you to learn from your mistake. For example, if your time stamp tells you something about when the comet will next appear, you could print
Comet's next expected appearance: December 29, 2546 (assumption: time stamp from X was given in seconds)
In this way, there is some "come back". In general, "document your assumptions" is not just good advice - it is essential in any exact science.
Finally - the conversion of a time stamp from ms to s is achieved by dividing the number by 1000. But I'm sure you know that.