Log file system implemented

This commit is contained in:
2023-08-25 17:41:42 +02:00
parent 0d8fa6449c
commit 5ca5b76d7c
5 changed files with 260 additions and 117 deletions

View File

@@ -2,8 +2,12 @@
* @name Cinnamon-Dynamic-Wallpaper
* @alias TobiZog
* @since 2023
*
* @description Functions to calculate sun time periods
*/
/******************** Constants ********************/
const DAYPERIOD = {
MTWILIGHT: 0,
SUNRISE: 1,
@@ -22,6 +26,9 @@ const J1970 = 2440588
const J2000 = 2451545
/******************** Functions ********************/
function fromJulian(j) {
let ms_date = (j + 0.5 - J1970) * DAYMS
return new Date(ms_date)
@@ -83,6 +90,14 @@ function subTimesToMinutes(date1, date2) {
}
/**
* Calculating the start and end time of all time periods of the day
*
* @param {float} latitude Location latitude
* @param {float} longitude Location longitude
*
* @returns JSON of time periods
*/
function calcTimePeriod(latitude, longitude) {
let todaySunEventsDay = sunEventsOfDay(latitude, longitude, Date.now())
let tomorrowSunEventsDay = sunEventsOfDay(latitude, longitude, addMinutesToTime(new Date(), 1440))