wmsun: Add -12 command line option to use 12-hour clock.
This commit is contained in:
		
							parent
							
								
									2fe82fe86e
								
							
						
					
					
						commit
						d8688d16d9
					
				
					 2 changed files with 19 additions and 0 deletions
				
			
		| 
						 | 
					@ -28,6 +28,9 @@ Set longitude of observer.
 | 
				
			||||||
Set the difference beteeen UT and LT. Useful when you want to show the
 | 
					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.
 | 
					Sunrise/Sunset at a remote lat/lon without resetting your clock.
 | 
				
			||||||
.TP
 | 
					.TP
 | 
				
			||||||
 | 
					.B \-12
 | 
				
			||||||
 | 
					Use 12-hour clock.
 | 
				
			||||||
 | 
					.TP
 | 
				
			||||||
.B \-date <yyyymmdd>
 | 
					.B \-date <yyyymmdd>
 | 
				
			||||||
Set the date to show sunrise/sunset for.
 | 
					Set the date to show sunrise/sunset for.
 | 
				
			||||||
.SH EXAMPLES
 | 
					.SH EXAMPLES
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -108,6 +108,7 @@ int	UseUserTimeDiff = 0;
 | 
				
			||||||
int	UseUserDate = 0;
 | 
					int	UseUserDate = 0;
 | 
				
			||||||
long	UserDate;
 | 
					long	UserDate;
 | 
				
			||||||
double 	Glat, Glon, SinGlat, CosGlat, TimeZone, UserTimeDiff;
 | 
					double 	Glat, Glon, SinGlat, CosGlat, TimeZone, UserTimeDiff;
 | 
				
			||||||
 | 
					int	TwelveHour = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int	xDigit[11] = {8, 18, 27, 37, 46, 55, 64, 74, 83, 92, 102};
 | 
					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){
 | 
							if (LTRise > 0.0){
 | 
				
			||||||
	    	    val = LTRise;
 | 
						    	    val = LTRise;
 | 
				
			||||||
	    	    H = (int)val; val = (val-H)*60.0;
 | 
						    	    H = (int)val; val = (val-H)*60.0;
 | 
				
			||||||
 | 
							    if (TwelveHour) {
 | 
				
			||||||
 | 
								H = H % 12;
 | 
				
			||||||
 | 
								if (H == 0)
 | 
				
			||||||
 | 
								    H = 12;
 | 
				
			||||||
 | 
							    }
 | 
				
			||||||
	    	    M = (int)val;
 | 
						    	    M = (int)val;
 | 
				
			||||||
	    	    copyXPMArea(xDigit[H/10], 73, 7, 9, 17, 13);
 | 
						    	    copyXPMArea(xDigit[H/10], 73, 7, 9, 17, 13);
 | 
				
			||||||
	    	    copyXPMArea(xDigit[H%10], 73, 7, 9, 17+7, 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){
 | 
							if (LTSet > 0.0){
 | 
				
			||||||
	    	    val = LTSet;
 | 
						    	    val = LTSet;
 | 
				
			||||||
	    	    H = (int)val; val = (val-H)*60.0;
 | 
						    	    H = (int)val; val = (val-H)*60.0;
 | 
				
			||||||
 | 
							    if (TwelveHour) {
 | 
				
			||||||
 | 
								H = H % 12;
 | 
				
			||||||
 | 
								if (H == 0)
 | 
				
			||||||
 | 
								    H = 12;
 | 
				
			||||||
 | 
							    }
 | 
				
			||||||
	    	    M = (int)val;
 | 
						    	    M = (int)val;
 | 
				
			||||||
	    	    copyXPMArea(xDigit[H/10], 73, 7, 9, 17, 40);
 | 
						    	    copyXPMArea(xDigit[H/10], 73, 7, 9, 17, 40);
 | 
				
			||||||
	    	    copyXPMArea(xDigit[H%10], 73, 7, 9, 17+7, 40);
 | 
						    	    copyXPMArea(xDigit[H%10], 73, 7, 9, 17+7, 40);
 | 
				
			||||||
| 
						 | 
					@ -347,6 +358,10 @@ void ParseCMDLine(int argc, char *argv[]) {
 | 
				
			||||||
	    UseUserDate = 1;
 | 
						    UseUserDate = 1;
 | 
				
			||||||
	    UserDate = atoi(argv[++i]);
 | 
						    UserDate = atoi(argv[++i]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						} else if (!strcmp(argv[i], "-12")){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						    TwelveHour = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
	    printf("\nwmSun version: %s\n", WMSUN_VERSION);
 | 
						    printf("\nwmSun version: %s\n", WMSUN_VERSION);
 | 
				
			||||||
	    printf("\nusage: wmSun [-display <Display>] [-lat <Latitude>] [-lon <Longitude>] [-h]\n\n");
 | 
						    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-lat <Latitude>\t\tObservers Latitude. Positive to the west.\n");
 | 
				
			||||||
	    printf("\t-lon <Longitude>\tObservers Longitude.\n");
 | 
						    printf("\t-lon <Longitude>\tObservers Longitude.\n");
 | 
				
			||||||
	    printf("\t-td <Delta Time>\tUser defined difference between UT an LT (hrs).\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");
 | 
						    printf("\t-h\t\t\tDisplay help screen.\n\n");
 | 
				
			||||||
	    exit(1);
 | 
						    exit(1);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue