Browse Source

* timezone.inc dep for linux.ppu
* fixed sigsegvs with wrong timezone settigns

peter 26 years ago
parent
commit
e85d23980b
3 changed files with 37 additions and 18 deletions
  1. 2 2
      rtl/linux/Makefile
  2. 1 1
      rtl/linux/Makefile.fpc
  3. 34 15
      rtl/linux/timezone.inc

+ 2 - 2
rtl/linux/Makefile

@@ -1,5 +1,5 @@
 #
 #
-# Makefile generated by fpcmake v0.99.13 on 1999-11-25 23:51
+# Makefile generated by fpcmake v0.99.13 on 1999-12-02 12:06
 #
 #
 
 
 defaultrule: all
 defaultrule: all
@@ -1081,7 +1081,7 @@ strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc\
 #
 #
 
 
 linux$(PPUEXT) : linux.pp strings$(PPUEXT) $(INC)/textrec.inc $(INC)/filerec.inc \
 linux$(PPUEXT) : linux.pp strings$(PPUEXT) $(INC)/textrec.inc $(INC)/filerec.inc \
-		 syscalls.inc systypes.inc sysconst.inc $(SYSTEMPPU)
+		 syscalls.inc systypes.inc sysconst.inc timezone.inc $(SYSTEMPPU)
 
 
 ports$(PPUEXT) : ports.pp linux$(PPUEXT) objpas$(PPUEXT)
 ports$(PPUEXT) : ports.pp linux$(PPUEXT) objpas$(PPUEXT)
 
 

+ 1 - 1
rtl/linux/Makefile.fpc

@@ -119,7 +119,7 @@ strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc\
 #
 #
 
 
 linux$(PPUEXT) : linux.pp strings$(PPUEXT) $(INC)/textrec.inc $(INC)/filerec.inc \
 linux$(PPUEXT) : linux.pp strings$(PPUEXT) $(INC)/textrec.inc $(INC)/filerec.inc \
-                 syscalls.inc systypes.inc sysconst.inc $(SYSTEMPPU)
+                 syscalls.inc systypes.inc sysconst.inc timezone.inc $(SYSTEMPPU)
 
 
 ports$(PPUEXT) : ports.pp linux$(PPUEXT) objpas$(PPUEXT)
 ports$(PPUEXT) : ports.pp linux$(PPUEXT) objpas$(PPUEXT)
 
 

+ 34 - 15
rtl/linux/timezone.inc

@@ -72,25 +72,32 @@ var
   info : pttinfo;
   info : pttinfo;
   i    : longint;
   i    : longint;
 begin
 begin
+{ reset }
+  TZDaylight:=false;
+  TZSeconds:=0;
+  TZName[false]:=nil;
+  TZName[true]:=nil;
+  leap_correct:=0;
+  leap_hit:=0;
+{ get info }
   info:=find_transition(timer);
   info:=find_transition(timer);
+  if not assigned(info) then
+   exit;
   TZDaylight:=info^.isdst;
   TZDaylight:=info^.isdst;
   TZSeconds:=info^.offset;
   TZSeconds:=info^.offset;
   i:=0;
   i:=0;
-  while (i<num_types) and (i<2) do
+  while (i<num_types) do
    begin
    begin
      tzname[types[i].isdst]:=@zone_names[types[i].idx];
      tzname[types[i].isdst]:=@zone_names[types[i].idx];
      inc(i);
      inc(i);
    end;
    end;
   tzname[info^.isdst]:=@zone_names[info^.idx];
   tzname[info^.isdst]:=@zone_names[info^.idx];
-  leap_correct:=0;
-  leap_hit:=0;
   i:=num_leaps;
   i:=num_leaps;
-  while (i>0) do
-   begin
-     if (timer>leaps[i].transition) then
-      break;
-     dec(i);
-   end;
+  repeat
+    if i=0 then
+     exit;
+    dec(i);
+  until (timer>leaps[i].transition);
   leap_correct:=leaps[i].change;
   leap_correct:=leaps[i].change;
   if (timer=leaps[i].transition) and
   if (timer=leaps[i].transition) and
      (((i=0) and (leaps[i].change>0)) or
      (((i=0) and (leaps[i].change>0)) or
@@ -246,16 +253,28 @@ end;
 
 
 procedure DoneLocalTime;
 procedure DoneLocalTime;
 begin
 begin
-  freemem(transitions);
-  freemem(type_idxs);
-  freemem(types);
-  freemem(zone_names);
-  freemem(leaps);
+  if assigned(transitions) then
+   freemem(transitions);
+  if assigned(type_idxs) then
+   freemem(type_idxs);
+  if assigned(types) then
+   freemem(types);
+  if assigned(zone_names) then
+   freemem(zone_names);
+  if assigned(leaps) then
+   freemem(leaps);
+  num_transitions:=0;
+  num_leaps:=0;
+  num_types:=0;
 end;
 end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.1  1999-12-01 22:46:59  peter
+  Revision 1.2  1999-12-02 11:25:31  peter
+    * timezone.inc dep for linux.ppu
+    * fixed sigsegvs with wrong timezone settigns
+
+  Revision 1.1  1999/12/01 22:46:59  peter
     + timezone support
     + timezone support
 
 
 }
 }