6tail / tyme4j

Tyme是一个非常强大的日历工具库,可以看作 Lunar 的升级版,拥有更优的设计和扩展性,支持公历和农历、星座、干支、生肖、节气、法定假日等。
https://6tail.cn/tyme.html
MIT License
69 stars 20 forks source link

EgihtChar.getSolarTimes add ignoreHour #6

Open icefairy opened 1 week ago

icefairy commented 1 week ago

test

var ut = 0L
    val startY = 1000
    val endY = 3000
    ut = measureTimeMillis {
        val ec = EightChar("癸亥", "丙辰", "己丑", "乙亥")
        val res = ec.getSolarTimes(startY, endY)
        println(res.size)
        println(res)
    }
    println("====use time:${ut} ms")
    ut = measureTimeMillis {
        val ec = EightChar("癸亥", "丙辰", "己丑", "丁亥")
        val res = ec.getSolarTimes(startY, endY, true)
        println(res.size)
        println(res)
    }

with log

17
[1023年4月18日 22:00:00, 1083年4月3日 22:00:00, 1263年4月18日 22:00:00, 1323年4月3日 22:00:00, 1503年4月18日 22:00:00, 1563年4月3日 22:00:00, 1743年4月29日 22:00:00, 1803年4月15日 22:00:00, 1983年5月1日 22:00:00, 2043年4月16日 22:00:00, 2223年5月3日 22:00:00, 2283年4月18日 22:00:00, 2463年5月4日 22:00:00, 2523年4月20日 22:00:00, 2583年4月5日 22:00:00, 2763年4月22日 22:00:00, 2823年4月7日 22:00:00]
====use time:60 ms
17
[1023年4月18日 22:00:00, 1083年4月3日 22:00:00, 1263年4月18日 22:00:00, 1323年4月3日 22:00:00, 1503年4月18日 22:00:00, 1563年4月3日 22:00:00, 1743年4月29日 22:00:00, 1803年4月15日 22:00:00, 1983年5月1日 22:00:00, 2043年4月16日 22:00:00, 2223年5月3日 22:00:00, 2283年4月18日 22:00:00, 2463年5月4日 22:00:00, 2523年4月20日 22:00:00, 2583年4月5日 22:00:00, 2763年4月22日 22:00:00, 2823年4月7日 22:00:00]
====use time:9 ms
var ut = 0L
    val startY = 1000
    val endY = 3000
    ut = measureTimeMillis {
        val ec = EightChar("癸亥", "丙辰", "己丑", "丁亥")
        val res = ec.getSolarTimes(startY, endY)
        println(res.size)
        println(res)
    }
    println("====use time:${ut} ms")
    ut = measureTimeMillis {
        val ec = EightChar("癸亥", "丙辰", "己丑", "丁亥")
        val res = ec.getSolarTimes(startY, endY, false)
        println(res.size)
        println(res)
    }
    println("====use time:${ut} ms")

with log

0
[]
====use time:53 ms
0
[]
====use time:7 ms