Selaa lähdekoodia

Added modified time getters.

Brucey 2 vuotta sitten
vanhempi
commit
7f06338bb8
3 muutettua tiedostoa jossa 50 lisäystä ja 2 poistoa
  1. 5 1
      core.mod/common.bmx
  2. 29 1
      core.mod/core.bmx
  3. 16 0
      core.mod/glue.c

+ 5 - 1
core.mod/common.bmx

@@ -108,7 +108,11 @@ Extern
 	Function bmx_libarchive_archive_entry_unset_birthtime(handle:Byte Ptr)
 	Function bmx_libarchive_archive_entry_unset_ctime(handle:Byte Ptr)
 	Function bmx_libarchive_archive_entry_filetype:EArchiveFileType(handle:Byte Ptr)
-
+	Function bmx_libarchive_archive_entry_mtime:Int(handle:Byte Ptr)
+	Function bmx_libarchive_archive_entry_mtime_nsec:Int(handle:Byte Ptr)
+	Function bmx_libarchive_archive_entry_mtime_is_set:Int(handle:Byte Ptr)
+	Function bmx_libarchive_archive_entry_unset_mtime(handle:Byte Ptr)
+		
 	Function archive_error_string:Byte Ptr(handle:Byte Ptr)
 End Extern
 

+ 29 - 1
core.mod/core.bmx

@@ -623,7 +623,7 @@ Type TWriteArchive Extends TArchive
 			entry.SetPermission(420) ' 0644
 			entry.SetSize(size)
 			If ftime Then
-				entry.SetBirthTime(ftime)
+				entry.SetModifiedTime(ftime)
 			End If
 		End If
 
@@ -1023,6 +1023,34 @@ Type TArchiveEntry
 		bmx_libarchive_archive_entry_set_mtime(entryPtr, time, nanoseconds)
 	End Method
 
+	Rem
+	bbdoc: Returns the entry modified time, if set.
+	End Rem
+	Method ModifiedTime:Long()
+		return bmx_libarchive_archive_entry_mtime(entryPtr)
+	End Method
+
+	Rem
+	bbdoc: Returns the entry modified time, in nanoseconds.
+	End Rem
+	Method ModifiedTimeNano:Long()
+		return bmx_libarchive_archive_entry_mtime_nsec(entryPtr)
+	End Method
+
+	Rem
+	bbdoc: Returns #True if the modified time is set.
+	End Rem
+	Method ModifiedTimeIsSet:Int()
+		return bmx_libarchive_archive_entry_mtime_is_set(entryPtr)
+	End Method
+
+	Rem
+	bbdoc: Unsets the modified time.
+	End Rem
+	Method UnsetModifiedTime()
+		bmx_libarchive_archive_entry_unset_mtime(entryPtr)
+	End Method
+
 	Rem
 	bbdoc: Sets the pathname of the entry.
 	End Rem

+ 16 - 0
core.mod/glue.c

@@ -504,3 +504,19 @@ void bmx_libarchive_archive_entry_unset_ctime(struct archive_entry * entry) {
 int bmx_libarchive_archive_entry_filetype(struct archive_entry * entry) {
 	return archive_entry_filetype(entry);
 }
+
+BBInt64 bmx_libarchive_archive_entry_mtime(struct archive_entry * entry) {
+	return archive_entry_mtime(entry);
+}
+
+BBInt64 bmx_libarchive_archive_entry_mtime_nsec(struct archive_entry * entry) {
+	return archive_entry_mtime_nsec(entry);
+}
+
+int bmx_libarchive_archive_entry_mtime_is_set(struct archive_entry * entry) {
+	return archive_entry_mtime_is_set(entry);
+}
+
+void bmx_libarchive_archive_entry_unset_mtime(struct archive_entry * entry) {
+	archive_entry_unset_mtime(entry);
+}