Kaynağa Gözat

+ Timezone support for solaris

git-svn-id: trunk@14821 -
pierre 15 yıl önce
ebeveyn
işleme
df33542ca9
2 değiştirilmiş dosya ile 45 ekleme ve 0 silme
  1. 43 0
      rtl/solaris/unxfunc.inc
  2. 2 0
      rtl/unix/timezone.inc

+ 43 - 0
rtl/solaris/unxfunc.inc

@@ -119,3 +119,46 @@ Function fpFlock (fd,mode : longint) : cint;
 		if (fpFlock=-1) and (errno=ESysEACCES) then
 			errno:=ESysEWOULDBLOCK;
   end;
+
+const
+  SolarisTimeZoneFile = '/etc/default/init';
+  SolarisTimeZoneDir = '/usr/share/lib/zoneinfo/';
+
+{$define FPC_HAS_GETTIMEZONEFILE}  
+
+function GetTimezoneFile:shortstring;
+var
+  s : shortstring;
+  p : longint;
+  ft : text;
+begin
+  GetTimezoneFile:='';
+  assign(ft,SolarisTimeZoneFile);
+{$ifopt I+}
+  {$define OPT_I}
+{$endif}
+{$I-}  
+  reset(ft);
+  if IOResult=0 then
+    begin
+      while not eof(ft) do
+        begin
+          readln(ft,s);
+          p:=pos('#',s);
+          if p>0 then
+            s[0]:=chr(p-1);
+	  p:=pos('TZ=',s);
+          if p>0 then
+            begin
+	      GetTimeZoneFile:=SolarisTimeZoneDir+copy(s,p+3,length(s));
+              close(ft);
+              exit;
+	    end;
+	end;
+      close(ft);	
+    end;
+{$ifdef OPT_I}    
+  {$I+}
+{$endif}  
+end;
+

+ 2 - 0
rtl/unix/timezone.inc

@@ -272,6 +272,7 @@ Const
                                                 // compliant though
 {$ENDIF}
 
+{$ifndef FPC_HAS_GETTIMEZONEFILE}
 
 function GetTimezoneFile:shortstring;
 var
@@ -305,6 +306,7 @@ begin
 {$ENDIF}
 end;
 
+{$endif ndef FPC_HAS_GETTIMEZONEFILE}
 
 procedure InitLocalTime;
 begin