GithubHelp home page GithubHelp logo

学习 about chronos HOT 10 CLOSED

godcong avatar godcong commented on May 28, 2024
学习

from chronos.

Comments (10)

godcong avatar godcong commented on May 28, 2024

这是已经理好的每年的数据

from chronos.

songjian0270 avatar songjian0270 commented on May 28, 2024

如果要自定义如何定义的呢

from chronos.

godcong avatar godcong commented on May 28, 2024

自己定义的话得用另一套算法,但是这个算法有点误差. 算八字那个就是用的算法.
这个是现成的,是列表法,不是计算法.

from chronos.

songjian0270 avatar songjian0270 commented on May 28, 2024

列表法的规则有吗

from chronos.

songjian0270 avatar songjian0270 commented on May 28, 2024

func GetTermInfo(y, n int) int {
y = fixSuffix(y)
if y < 0 || y > len(termInfoList) {
return -1
}
if n < 1 || n > 24 {
return -1
}
i := (n - 1) / 4 * 5
n = (n - 1) % 4
idx, _ := strconv.ParseInt(termInfoList[y][i:i+5], 16, 64)
a := strconv.FormatInt(idx, 10)
day := []string{a[0:1], a[1:3], a[3:4], a[4:6]}
i, _ = strconv.Atoi(day[n])
return i
}

不是很理解取值之后,得到个整型,然后截取放到数组

from chronos.

songjian0270 avatar songjian0270 commented on May 28, 2024

func StemBranchMonth(y, m, d int) string {
//月柱 1900年1月小寒以前为 丙子月(60进制12)
fir := GetTermInfo(y, m*2-1) //返回当月「节」为几日开始

//依据12节气修正干支月
var sb = GetStemBranch(fixSuffix(y)*12 + m + 11)
if d >= fir {
	sb = GetStemBranch(fixSuffix(y)*12 + m + 12)
}
return sb

}

输入天数和GetTermInfo 比 这个算法怎么理解大佬

from chronos.

godcong avatar godcong commented on May 28, 2024

你看调用的地方,一个月里面有2个节气,所以返回的是第几天,就一个整数

from chronos.

songjian0270 avatar songjian0270 commented on May 28, 2024

GetTermInfo 得到个整型,16进制然后截取 在放在数组中 这个规则是什么的呢

from chronos.

godcong avatar godcong commented on May 28, 2024

没有什么规则啊,这就是一个列表,哪一位对应哪一个节气,这个节气是第几天.

from chronos.

songjian0270 avatar songjian0270 commented on May 28, 2024

嗯嗯

from chronos.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.