Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
nickxbs committed Aug 21, 2024
1 parent df74eff commit ad166a9
Show file tree
Hide file tree
Showing 21 changed files with 1,944 additions and 1,949 deletions.
25 changes: 13 additions & 12 deletions src/sinus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,35 @@ function getCurrentHourDecimalInTimezone(timezone) {
timeZone: timezone,
minute: 'numeric',
});
return parseFloat(hours) + parseFloat(minutes) / 60;
const time = parseFloat(hours) + parseFloat(minutes) / 60;
return { time, hours: parseInt(hours), minutes: parseInt(minutes) };
}

export default function (timezone: string) {
// time of the day in hours - decimals, not minutes
const hours = getCurrentHourDecimalInTimezone(timezone);
const hours2 =
(Date.now() / 86400000 - Math.floor(Date.now() / 86400000)) * 24 + 2;
const { time, minutes, hours } = getCurrentHourDecimalInTimezone(timezone);
logger.debug(
'time of the day in hours - using decimals, not minutes: %o',
hours.toFixed(2),
time.toFixed(2),
);

// express minutes also;
const hoursAbs = Math.floor(hours);
const minutes = (hours - hoursAbs) * 60;
// const hoursAbs = Math.floor(hours);
// const minutes = (hours - hoursAbs) * 60;

logger.debug('express hours: %o', hours.toFixed(), 'minutes');
logger.debug(
'express minutes in minutes also: %o',
minutes.toFixed(),
'minutes',
);

// time of the day in 2 pi cycle;
const daycycle = (hours * Math.PI) / 12;
logger.debug('time of the day in 2 pi cycle %o', daycycle.toFixed(2));
const dayCycle = (time * Math.PI) / 12;
logger.debug('time of the day in 2 pi cycle %o', dayCycle.toFixed(2));

// time of the day in 360 deg cycle;
const dayCycleDeg = (hours * 360) / 24;
const dayCycleDeg = (time * 360) / 24;
logger.debug('time of the day in 360 deg cycle %o', dayCycleDeg.toFixed(2));

// value of the sin function according to hours, oscillating from -1 to +1;
Expand Down Expand Up @@ -69,7 +70,7 @@ export default function (timezone: string) {
);
logger.debug(
'When the time of day is ' +
hours.toFixed() +
time.toFixed() +
' hours and ' +
minutes.toFixed() +
' minutes, the sinusoidal value is: ' +
Expand All @@ -87,7 +88,7 @@ export default function (timezone: string) {
);
logger.debug(
'When the time of day is ' +
hours.toFixed() +
time.toFixed() +
' hours and ' +
minutes.toFixed() +
' minutes, the cosinusoidal value is: ' +
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit ad166a9

Please sign in to comment.