[Debian-zh-dev] Bug#854019: Fw: Patch for lunar.c while lunar.clock == 23

Xie Xun xiexun162534 at gmail.com
Sat Feb 4 05:18:32 UTC 2017



     On Saturday, February 4, 2017 1:42 AM, usv <usv at localhost.localdomain> wrote:
 

 Hi,  Xie Xun
-------------cut-here---------------------
--- lunar/lunar.orig    2001-10-29 13:55:39.000000000 +0800
+++ lunar/lunar.c    2017-02-04 00:58:07.487220461 +0800
@@ -271,12 +271,18 @@
    int adj;
    Date *d;
 
-    /* A solar day begins at 12 a.m. */
-    adj = (lunar.hour == 23)? -1 : 0;
    offset = Lunar2Day(&lunar);
-    solar.weekday = (offset+ adj + SolarFirstDate.weekday) % 7;
-    Day2Solar(offset + adj, &solar);
+    solar.weekday = (offset + SolarFirstDate.weekday) % 7;
+    Day2Solar(offset, &solar);
    solar.hour = lunar.hour;
+
+    /* A lunar day begins at 11 p.m. so this time is next lunar day */
+    if (lunar.hour == 23)
+      {
+        Day2Lunar(offset + 1, &lunar);
+        offset = Lunar2Day(&lunar);
+      }
+
    CalGZ(offset, &lunar, &gan, &zhi);
 
    jieAlert = JieDate(&solar, &lunar2);
-------------------end-patch-----------------
Thanks
lunar user


   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/chinese-developers/attachments/20170204/08f77a97/attachment.html>


More information about the Chinese-developers mailing list