Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function「彼年何年」issue: use 黄帝纪元四千七百一十六年 as an example #489

Open
kaiyuan01 opened this issue Jan 4, 2020 · 4 comments
Labels
stdlib Issues related to standard library

Comments

@kaiyuan01
Copy link
Contributor

黄帝纪元四千七百一十六年 is Year 2018, yet the function returns 1969:

施「彼年何年」於四千七百一十六

, we get:

一千九百六十九

Is this a bug?

@statementreply
Copy link
Contributor

The input of 彼年何年 is Unix timestamp. See also https://github.com/LingDong-/wenyan-lang/pull/487#issuecomment-570838787

@kaiyuan01
Copy link
Contributor Author

kaiyuan01 commented Jan 5, 2020

Thanks for the reply.

Here is the definition from Li Fa:

注曰「「彼年何年。同Javascript之new Date(x * 1000).getFullYear() for modern dates, in Chinese calendar也。」」
今有一術。名之曰「彼年何年」。欲行是術。必先得一數。曰「時」。乃行是術曰。
施「彼年積何年」於「時」。減其以二六九七。乃得矣。
是謂「彼年何年」之術也。

注曰「「彼年積何年。同Javascript之new Date(x * 1000).getFullYear() + 2697, in Chinese calendar也。」」
今有一術。名之曰「彼年積何年」。欲行是術。必先得一數。曰「時」。乃行是術曰。
施「彼月積何月」於「時」。名之曰「積月」。
夫「積月」。取一以施「月積何閏月」。名之曰「積閏月」。
減「積月」以「積閏月」。除其以十二。取一以施「取底」。乃得矣。
是謂「彼年積何年」之術也。

From "減其以二六九七。乃得矣。" I think it's based on Chinese calendar. If the input is the number of seconds after epoch time in Linux, that output might make sense. (4716 secs past beginning of 1970 is Year 1969 in Chinese calendar)

Should we name it "彼何年" instead of "彼何年" to avoid confusion since the input is in secs instead of years?

@LingDong-
Copy link
Member

Should we name it "彼時何年" instead of "彼年何年" to avoid confusion since the input is in secs instead of years?

Good suggestion, however, there is only one problem, which is also means the (Chinese) hour. It has the potential to cause even greater confusion. Also, this repetition of the second and fourth characters in these function names comes from 今夕何夕, 今日何日, etc. and has a poetic quality to it. Of course, clarity is also important. We'll need to consider this more.

@LingDong- LingDong- added the stdlib Issues related to standard library label Jan 5, 2020
@cuixiping
Copy link
Contributor

Does it mean 彼秒何年?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Issues related to standard library
Projects
None yet
Development

No branches or pull requests

4 participants