Giter VIP home page Giter VIP logo

gan_zhi's Introduction

gan_zhi

1、介绍

gan_zhi 是一个根据公历日期、时得到相应的天干地支的工具软件包。

1.1 目录结构

名称 说明
examples 例子目录
inc 头文件目录
src 源代码目录

1.2 许可证

gan_zhi package 遵循 MIT 许可,详见 LICENSE 文件。

1.3 依赖

  • RT-Thread 3.0+

2、如何打开 gan_zhi

使用 gan_zhi package 需要在 RT-Thread 的包管理器中选择它,具体路径如下:

RT-Thread online packages
    tools packages --->
        [*] gan_zhi: A tool package to get tiangan and dizhi informations according to the date and time.

然后让 RT-Thread 的包管理器自动更新,或者使用 pkgs --update 命令更新包到 BSP 中。

3、使用 gan_zhi

在使用 gan_zhi 软件包时首先要定义一个char数组来存储返回年、月、日、时的天干地支,如:

char str[32] = {'\0'};

调用的函数接口为:

int get_lunar_year(int year, int month, int day);
int get_gan_zhi(int year, int month, int day, int hour);
signed char sun_hour2gan_zhi(int year, int month, int day, int hour, char *str_gan_zhi);

比如:

static int showgan_zhi(int argc, char const *argv[]) {
    if (argc == 5) {
        char str[32] = {'\0'};
        sun_hour2gan_zhi(atoi(argv[1]), atoi(argv[2]), atoi(argv[3]), atoi(argv[4]), str);
        printf("%s\n", str);
    }
    return 0;
}
#ifdef FINSH_USING_MSH
MSH_CMD_EXPORT(showgan_zhi, showgan_zhi generator: showgan_zhi[year][month][day][hour]);
#endif /* FINSH_USING_MSH */

在 MSH 中输入命令 showgan_zhi 2021 4 23 15,可以在串口助手上看到输出了距离最近的下一个节气信息。

msh />showgan_zhi 2021 4 23 15
辛丑年壬辰月辛丑日丙申时

在打开 gan_zhi package 示例后,当进行 bsp 编译时,它会被加入到 bsp 工程中进行编译。

4、注意事项

  • 当前可以生成天干地支信息对应的阳历范围为 1900-1-1 到2099-12-31。
  • 文件统一使用UTF-8编码。

5、联系方式 & 感谢

gan_zhi's People

Stargazers

Chen Zhicheng avatar yyhc avatar

Watchers

 avatar

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.