daystart.qsrc 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # daystart
  2. !!sets daystart_start to current day and must be called only after start date is set
  3. if daystart_start = 0:
  4. if month > 1:daystart_start += 31
  5. if month > 2:
  6. if ((year mod 4 = 0) and (year mod 100 ! 0)) or (year mod 400 = 0):
  7. daystart_start += 29
  8. else
  9. daystart_start += 28
  10. end
  11. end
  12. if month > 3:daystart_start += 31
  13. if month > 4:daystart_start += 30
  14. if month > 5:daystart_start += 31
  15. if month > 6:daystart_start += 30
  16. if month > 7:daystart_start += 31
  17. if month > 8:daystart_start += 31
  18. if month > 9:daystart_start += 30
  19. if month > 10:daystart_start += 31
  20. if month > 11:daystart_start += 30
  21. if month > 12:daystart_start += 31
  22. daystart_start += day
  23. end
  24. daystart = (year - 2016) * 365
  25. !!Leap year correction, offset not needed as 2016 is a leap year and start date is after February
  26. daystart += (year - 2016) / 4
  27. i=1
  28. :daystart
  29. if month > i:
  30. daystart += monthsend[i]
  31. i += 1
  32. jump 'daystart'
  33. end
  34. daystart += day
  35. daystart -= daystart_start
  36. daystart += 1
  37. --- daystart ---------------------------------