[Pkg-wmaker-commits] [wmsun] 32/73: wmsun: Add -12 command line option to use 12-hour clock.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Fri Aug 28 12:04:45 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch master
in repository wmsun.

commit 5464435cdffe34bc16e349adfae8bcfb3a2046fb
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date:   Sun Jun 14 17:04:47 2015 -0500

    wmsun: Add -12 command line option to use 12-hour clock.
---
 wmSun.1 |  3 +++
 wmSun.c | 16 ++++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/wmSun.1 b/wmSun.1
index 95b5ba5..33cbd88 100644
--- a/wmSun.1
+++ b/wmSun.1
@@ -28,6 +28,9 @@ Set longitude of observer.
 Set the difference beteeen UT and LT. Useful when you want to show the
 Sunrise/Sunset at a remote lat/lon without resetting your clock.
 .TP
+.B \-12
+Use 12-hour clock.
+.TP
 .B \-date <yyyymmdd>
 Set the date to show sunrise/sunset for.
 .SH EXAMPLES
diff --git a/wmSun.c b/wmSun.c
index 249eb3c..f3fc778 100644
--- a/wmSun.c
+++ b/wmSun.c
@@ -108,6 +108,7 @@ int	UseUserTimeDiff = 0;
 int	UseUserDate = 0;
 long	UserDate;
 double 	Glat, Glon, SinGlat, CosGlat, TimeZone, UserTimeDiff;
+int	TwelveHour = 0;
 
 
 int	xDigit[11] = {8, 18, 27, 37, 46, 55, 64, 74, 83, 92, 102};
@@ -225,6 +226,11 @@ int main(int argc, char *argv[]) {
 		if (LTRise > 0.0){
 	    	    val = LTRise;
 	    	    H = (int)val; val = (val-H)*60.0;
+		    if (TwelveHour) {
+			H = H % 12;
+			if (H == 0)
+			    H = 12;
+		    }
 	    	    M = (int)val;
 	    	    copyXPMArea(xDigit[H/10], 73, 7, 9, 17, 13);
 	    	    copyXPMArea(xDigit[H%10], 73, 7, 9, 17+7, 13);
@@ -239,6 +245,11 @@ int main(int argc, char *argv[]) {
 		if (LTSet > 0.0){
 	    	    val = LTSet;
 	    	    H = (int)val; val = (val-H)*60.0;
+		    if (TwelveHour) {
+			H = H % 12;
+			if (H == 0)
+			    H = 12;
+		    }
 	    	    M = (int)val;
 	    	    copyXPMArea(xDigit[H/10], 73, 7, 9, 17, 40);
 	    	    copyXPMArea(xDigit[H%10], 73, 7, 9, 17+7, 40);
@@ -347,6 +358,10 @@ void ParseCMDLine(int argc, char *argv[]) {
 	    UseUserDate = 1;
 	    UserDate = atoi(argv[++i]);
 
+	} else if (!strcmp(argv[i], "-12")){
+
+	    TwelveHour = 1;
+
 	} else {
 	    printf("\nwmSun version: %s\n", WMSUN_VERSION);
 	    printf("\nusage: wmSun [-display <Display>] [-lat <Latitude>] [-lon <Longitude>] [-h]\n\n");
@@ -355,6 +370,7 @@ void ParseCMDLine(int argc, char *argv[]) {
 	    printf("\t-lat <Latitude>\t\tObservers Latitude. Positive to the west.\n");
 	    printf("\t-lon <Longitude>\tObservers Longitude.\n");
 	    printf("\t-td <Delta Time>\tUser defined difference between UT an LT (hrs).\n");
+	    printf("\t-12\t\t\tUse 12-hour clock.\n");
 	    printf("\t-h\t\t\tDisplay help screen.\n\n");
 	    exit(1);
 	}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmsun.git



More information about the Pkg-wmaker-commits mailing list