diff --git a/src/commonMain/kotlin/dev/inmo/krontab/internal/CronDateTime.kt b/src/commonMain/kotlin/dev/inmo/krontab/internal/CronDateTime.kt index 2200a06..350a066 100644 --- a/src/commonMain/kotlin/dev/inmo/krontab/internal/CronDateTime.kt +++ b/src/commonMain/kotlin/dev/inmo/krontab/internal/CronDateTime.kt @@ -57,71 +57,6 @@ internal data class CronDateTime( } } } -// -///** -// * THIS METHOD WILL NOT TAKE CARE ABOUT [offset] PARAMETER. It was decided due to the fact that we unable to get -// * real timezone offset from simple [DateTime] -// * -// * @return The near [DateTime] which happens after [relativelyTo] or will be equal to [relativelyTo] -// */ -//internal fun CronDateTime.toNearDateTime(relativelyTo: DateTime = DateTime.now()): DateTime? { -// var current = relativelyTo -// -// val weekDay = dayOfWeekInt -// if (weekDay != null && current.dayOfWeek.index0 != weekDay) { -// do { -// var diff = weekDay - current.dayOfWeek.index0 -// if (diff < 0) { -// diff += 7 /* days in week */ -// } -// current = (current + diff.days).startOfDay -// -// val next = toNearDateTime(current) -// if (next == null || next.dayOfWeek.index0 == weekDay) { -// return next -// } -// } while (true) -// } -// -// seconds?.let { -// val left = it - current.seconds -// current += DateTimeSpan(minutes = if (left <= 0) 1 else 0, seconds = left) -// } -// -// minutes?.let { -// val left = it - current.minutes -// current += DateTimeSpan(hours = if (left < 0) 1 else 0, minutes = left) -// } -// -// hours?.let { -// val left = it - current.hours -// current += DateTimeSpan(days = if (left < 0) 1 else 0, hours = left) -// } -// -// klockDayOfMonth ?.let { -// val left = (it - current.dayOfMonth).let { diff -> -// if (diff > 0 && current.endOfMonth.run { it > dayOfMonth && current.dayOfMonth == dayOfMonth }) { -// 0 -// } else { -// diff -// } -// } -// current += DateTimeSpan(months = if (left < 0) 1 else 0, days = left) -// } -// -// months?.let { -// val left = it - current.month0 -// current += DateTimeSpan(years = if (left < 0) 1 else 0, months = left) -// } -// -// years?.let { -// if (current.yearInt != it) { -// return null -// } -// } -// -// return current -//} internal fun createCronDateTime( seconds: Array? = null, @@ -133,37 +68,6 @@ internal fun createCronDateTime( weekDays: Array? = null ): CronDateTime { return CronDateTime(weekDays, years, month, dayOfMonth, hours, minutes, seconds) -// val resultCronDateTimes = mutableListOf(CronDateTime()) -// -// seconds ?.fillWith(resultCronDateTimes) { previousCronDateTime: CronDateTime, currentTime: Byte -> -// previousCronDateTime.copy(seconds = currentTime) -// } -// -// minutes ?.fillWith(resultCronDateTimes) { previousCronDateTime: CronDateTime, currentTime: Byte -> -// previousCronDateTime.copy(minutes = currentTime) -// } -// -// hours ?.fillWith(resultCronDateTimes) { previousCronDateTime: CronDateTime, currentTime: Byte -> -// previousCronDateTime.copy(hours = currentTime) -// } -// -// dayOfMonth ?.fillWith(resultCronDateTimes) { previousCronDateTime: CronDateTime, currentTime: Byte -> -// previousCronDateTime.copy(daysOfMonth = currentTime) -// } -// -// month ?.fillWith(resultCronDateTimes) { previousCronDateTime: CronDateTime, currentTime: Byte -> -// previousCronDateTime.copy(months = currentTime) -// } -// -// years ?.fillWith(resultCronDateTimes) { previousCronDateTime: CronDateTime, currentTime: Int -> -// previousCronDateTime.copy(years = currentTime) -// } -// -// weekDays ?.fillWith(resultCronDateTimes) { previousCronDateTime: CronDateTime, currentTime: Byte -> -// previousCronDateTime.copy(daysOfWeek = currentTime) -// } -// -// return resultCronDateTimes.toList() } /**