CalcMinsFromUTC was failing if time_t was unsigned. I really _should_

use difftime(), but not all systems have it.  Also, defs.rem was
rearranged so PostScript stuff works better, and new target "emxomf"
was added to makefile.ost which uses OMF linking and a
dynamically-linked C library.  All three of these fixes are courtesy
of Christopher J. Madsen <madsen@iglobal.net>.  Thanks, Christopher.
This commit is contained in:
dfs
1997-03-31 22:13:08 +00:00
parent ef9f13e83d
commit 8e17c968e2
4 changed files with 73 additions and 35 deletions

View File

@@ -1,5 +1,18 @@
CHANGES TO REMIND
* Version 3.0 Patch 17
+ BUG FIXES
- Added romanian.h to the manifest. Sorry.
- CalcMinsFromUTC was failing if time_t was unsigned. I really _should_
use difftime(), but not all systems have it. Also, defs.rem was rearranged
so PostScript stuff works better, and new target "emxomf" was added to
makefile.ost which uses OMF linking and a dynamically-linked C library.
All three of these fixes are courtesy of Christopher J. Madsen
<madsen@iglobal.net>. Thanks, Christopher.
* Version 3.0 Patch 16
+ MINOR ENHANCEMENTS

View File

@@ -22,7 +22,7 @@
#############################################################################
#
# $Id: defs.rem,v 1.3 1997-01-16 04:14:20 dfs Exp $
# $Id: defs.rem,v 1.4 1997-03-31 22:13:08 dfs Exp $
#
RUN OFF
@@ -307,51 +307,26 @@ IF !$RunOff && !$CalMode && !$SimpleCal
ENDIF
ENDIF
#PSSTUFF
#PSSTUFF1
##########################################################################
# #
# This portion of the file contains some cute examples of the new #
# PS-type reminders. You need a PostScript printer or viewer to #
# appreciate these. To use them, pipe the output of remind -p into the #
# rem2ps program. #
# rem2ps program. More examples are in the PSSTUFF2 section, below. #
# #
##########################################################################
# Convenient to stick all the PostScript code in a string var - makes
# reminders easier to understand and faster. The variable "shade" will
# contain PostScript code to shade in a particular box on the calendar.
SET shade psshade(95)
# The following reminder will shade the Saturday and Sunday calendar
# entries.
REM Sat Sun PS [shade]
# The following will fill in the Hebrew dates on the calendar. For this
# example, I recommend that you use the -sd 10 option for Rem2PS.
REM PS Border Border moveto \
/DayFont findfont DaySize scalefont setfont \
([hebday(today())] [hebmon(today())]) show
# Fill in the phases of the moon on the PostScript calendar
[trigger(moondate(0))] PS [psmoon(0)]
[trigger(moondate(1))] PS [psmoon(1)]
[trigger(moondate(2))] PS [psmoon(2)]
[trigger(moondate(3))] PS [psmoon(3)]
# The following example puts sunrise and sunset times in PostScript in the
# calendar - the sizes are hard-coded, however, and work best in landscape.
REM PS Border Border 5 sub moveto \
/SmallFont findfont 4 scalefont setfont \
(Sunrise: [sunrise(trigdate())] Sunset: [sunset(trigdate())]) show
# The next one puts the day number (1-366) and days left in the year at the
# bottom of the post-script calendar. Again, the hard-coded sizes work best
# in landscape.
FSET _DayOfYear(x) x-(date(year(x),1,1) - 1)
REM PS BoxWidth 3 mul 4 div Border 5 sub moveto \
/SmallFont findfont 4 scalefont setfont \
([_DayOfYear(today())]([365+isleap(today())-_DayOfYear(today())])) show
#USHOLS
#############################################################################
# #
@@ -413,7 +388,7 @@ OMIT Dec 25 MSG %"Christmas%" Day
# #
# The next block uses the shade variable defined in PSSTUFF above. #
# If any US holidays were triggered above, shade in the calendar #
# entry in PostScript. This is not quite correct, as it blots out the #
# entry in PostScript. This is not quite correct, as it blots out any #
# other PostScript stuff above. I was too lazy to do it properly :-) #
# #
##########################################################################
@@ -428,6 +403,42 @@ REM Sep [CHOOSE(YEAR(TODAY())-1991, 22,22,23,23,22,22,22,23,22)] \
MSG %"Fall%" begins
REM Dec [IIF((YEAR(TODAY())+1)%4, 21, 22)] MSG %"Winter%" begins
#PSSTUFF2
##########################################################################
# #
# Since the "psshade" command blots out any previous PostScript #
# reminders for a date, these examples need to follow the US Holidays #
# section, which uses psshade. See PSSTUFF1, above, for examples using #
# psshade. #
# #
##########################################################################
# The following will fill in the Hebrew dates on the calendar. For this
# example, I recommend that you use the -sd 10 option for Rem2PS.
REM PS Border Border moveto \
/DayFont findfont DaySize scalefont setfont \
([hebday(today())] [hebmon(today())]) show
# Fill in the phases of the moon on the PostScript calendar
[trigger(moondate(0))] PS [psmoon(0)]
[trigger(moondate(1))] PS [psmoon(1)]
[trigger(moondate(2))] PS [psmoon(2)]
[trigger(moondate(3))] PS [psmoon(3)]
# The following example puts sunrise and sunset times in PostScript in the
# calendar - the sizes are hard-coded, however, and work best in landscape.
REM PS Border Border 5 sub moveto \
/SmallFont findfont 4 scalefont setfont \
(Sunrise: [sunrise(trigdate())] Sunset: [sunset(trigdate())]) show
# The next one puts the day number (1-366) and days left in the year at the
# bottom of the post-script calendar. Again, the hard-coded sizes work best
# in landscape.
FSET _DayOfYear(x) x-(date(year(x),1,1) - 1)
REM PS BoxWidth 3 mul 4 div Border 5 sub moveto \
/SmallFont findfont 4 scalefont setfont \
([_DayOfYear(today())]([365+isleap(today())-_DayOfYear(today())])) show
#JHOLS
##########################################################################
# #

12
main.c
View File

@@ -11,7 +11,7 @@
/***************************************************************/
#include "config.h"
static char const RCSID[] = "$Id: main.c,v 1.5 1997-03-30 19:07:41 dfs Exp $";
static char const RCSID[] = "$Id: main.c,v 1.6 1997-03-31 22:13:09 dfs Exp $";
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
@@ -1223,6 +1223,7 @@ int jul, tim, *mins, *isdst;
/* Convert jul and tim to an Unix tm struct */
int yr, mon, day;
int tdiff;
struct tm local, utc, *temp;
time_t loc_t, utc_t;
@@ -1257,11 +1258,14 @@ int jul, tim, *mins, *isdst;
if (utc_t == -1) return 1;
#endif
temp = localtime(&loc_t);
/* Compute difference between local time and UTC in seconds.
Be careful, since time_t might be unsigned. */
tdiff = (loc_t < utc_t) ? -1*((int)(utc_t-loc_t)) : (loc_t-utc_t);
#ifdef HAVE_MKTIME
if (mins) *mins = (int) ( ((temp->tm_isdst) ? 60 : 0) +
(loc_t - utc_t) / 60 ); /* Should use difftime */
/* Should use difftime */
if (mins) *mins = (int)(((temp->tm_isdst) ? 60 : 0) + tdiff / 60 );
#else
if (mins) *mins = (int) ((utc_t - loc_t) / 60);
if (mins) *mins = (int)(tdiff / 60);
#endif
if (isdst) *isdst = temp->tm_isdst;
return 0;

View File

@@ -1,6 +1,6 @@
# Makefile for REMIND
#
# $Id: makefile.os2,v 1.2 1996-10-12 02:49:34 dfs Exp $
# $Id: makefile.os2,v 1.3 1997-03-31 22:13:09 dfs Exp $
#
# THIS IS OUT OF DATE!
#
@@ -18,6 +18,7 @@ default:
@echo " msc OS/2 exe [Microsoft C 6.00a] "
@echo " mscbnd OS/2 and DOS exe [Microsoft C 6.00a] "
@echo " emx OS/2 and DOS 32-bit exe [EMX/gcc] "
@echo " emxomf OS/2 32-bit exe w/DLL C library [EMX/gcc] "
msc:
@@ -41,6 +42,13 @@ emx:
CFLAGS="-D__OS2__ -D__MSDOS__" \
LFLAGS=""
emxomf:
$(MAKE) -f Makefile.os2 all \
CC="gcc -Zomf -O -s" O=".obj" \
CFLAGS="-D__OS2__" \
LFLAGS="-Zcrtdll -Zstack 32" \
LFLAGS2="remind.def"
# OS2_POPUP enables Russ Herman's popup reminders
#OS2_POPUP =
@@ -71,6 +79,8 @@ OBJS= $(SRCS:.c=$O)
all: remind.exe rem2ps.exe
.SUFFIXES: $O
.c$O:
$(CC) -c $(CFLAGS) $(OS2_POPUP) $*.c