Skip to content
Snippets Groups Projects
Commit 0a4d8444 authored by William Roberts's avatar William Roberts
Browse files

Make roofcam change time to be seconds from epoch

parent 3b4ed226
Branches dev main
No related tags found
No related merge requests found
Pipeline #9589 failed with stages
in 0 seconds
This diff is collapsed.
......@@ -56,9 +56,8 @@ function changeCamera() {
// Makes image update. Image updates every (about) 2 minutes and 15 seconds.
document.getElementById('roofCam').alt = document.getElementById('dirText').innerHTML = newDirection;
var date = new Date();
// Update image every 5 minutes. The date and hours ensures that it won't use pictures
// from previous days/hours if the cache isn't cleared in that time frame.
var formatted_date = String(date.getDate()) + date.getHours() + Math.floor(date.getMinutes() / 5);
// Update image every 5 minutes and let the final value be in seconds since epoch.
var formatted_date = Math.floor(date.getTime() / 1000 / 300) * 300;
document.getElementById('roofCam').src = METOBS_API_URL + '/pub/cache/aoss/cameras/' + newDirection +
'/latest_medium.jpg?t=' + formatted_date;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment