# Time Conversion Question

Hi guys,

I have a time stamp in a sketch I'm trying to figure out

const unsigned long UpdateInterval = 30L60L1000000L;

It's set to 30 minutes above. What would the conversion be to set it to say 3 minutes?

Can someone provide a link to how I would convert this because everything I've worked with so far has been just in milliseconds like

300000

Thanks

What I'm trying to do:
This is for a weather station updating to weather underground.

It is going into a sleep mode and the time isnt lining up with the sleep mode that's set. After 5 minutes I'm getting a solid blue light on the esp8266 and it won't continue to update the website.

t's set to 30 minutes above.

Is it ?
What units is that in ?

Tayethin:
const unsigned long UpdateInterval = 30L60L1000000L;

It's set to 30 minutes above. What would the conversion be to set it to say 3 minutes?

Presumably change the 30L to 3L ?

...R

If microseconds, that is 30 minutes. I wonder why anyone would use micros() for such a long period. The rollover happens after 70 minutes so it is dangerously close.

``````const unsigned long  UpdateInterval     = 30L*60L*1000000L;
``````

By the way, only the first constant needs the type specifier. Once the compiler knows it's dealing with a long type, all the expression math will be done in long arithmetic:

``````const unsigned long  UpdateInterval     = 30L*60*1000000;
``````

but it's also easy to guarantee that with a constant:

``````const unsigned long  MICROS_PER_SEC  =1000000L;
...
const unsigned long  UpdateInterval = MICROS_PER_SEC * 60 * 30;
``````

which has the added benefit of being more self-explanatory.

If you include the DateTime library, you already have similar conversion functions and you can also say:

``````const unsigned long  MICROS_PER_SEC  =1000000L;
...
const unsigned long  UpdateInterval = MICROS_PER_SEC * SECS_PER_MIN  * 30;
``````