summaryrefslogtreecommitdiffstats
path: root/twrp-functions.cpp
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2016-02-25 20:47:30 +0100
committerDees Troy <dees_troy@teamw.in>2016-03-31 16:44:24 +0200
commit472f506817bb1af2fceb039ba148d15723944562 (patch)
tree187516086121c42b1b671f69b4fc252fe5498b1c /twrp-functions.cpp
parentDataManager Updates (diff)
downloadandroid_bootable_recovery-472f506817bb1af2fceb039ba148d15723944562.tar
android_bootable_recovery-472f506817bb1af2fceb039ba148d15723944562.tar.gz
android_bootable_recovery-472f506817bb1af2fceb039ba148d15723944562.tar.bz2
android_bootable_recovery-472f506817bb1af2fceb039ba148d15723944562.tar.lz
android_bootable_recovery-472f506817bb1af2fceb039ba148d15723944562.tar.xz
android_bootable_recovery-472f506817bb1af2fceb039ba148d15723944562.tar.zst
android_bootable_recovery-472f506817bb1af2fceb039ba148d15723944562.zip
Diffstat (limited to 'twrp-functions.cpp')
-rw-r--r--twrp-functions.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/twrp-functions.cpp b/twrp-functions.cpp
index eb1f4c2f7..8d85ccf04 100644
--- a/twrp-functions.cpp
+++ b/twrp-functions.cpp
@@ -38,6 +38,7 @@
#include <algorithm>
#include "twrp-functions.hpp"
#include "twcommon.h"
+#include "gui/gui.hpp"
#ifndef BUILD_TWRPTAR_MAIN
#include "data.hpp"
#include "partitions.hpp"
@@ -45,7 +46,6 @@
#include "bootloader.h"
#include "cutils/properties.h"
#include "cutils/android_reboot.h"
-#include "gui/gui.hpp"
#include <sys/reboot.h>
#endif // ndef BUILD_TWRPTAR_MAIN
#ifndef TW_EXCLUDE_ENCRYPTED_BACKUPS
@@ -272,7 +272,7 @@ int TWFunc::Try_Decrypting_File(string fn, string password) {
#endif
}
-unsigned long TWFunc::Get_File_Size(string Path) {
+unsigned long TWFunc::Get_File_Size(const string& Path) {
struct stat st;
if (stat(Path.c_str(), &st) != 0)
@@ -329,6 +329,25 @@ vector<string> TWFunc::split_string(const string &in, char del, bool skip_empty)
return res;
}
+timespec TWFunc::timespec_diff(timespec& start, timespec& end)
+{
+ timespec temp;
+ if ((end.tv_nsec-start.tv_nsec)<0) {
+ temp.tv_sec = end.tv_sec-start.tv_sec-1;
+ temp.tv_nsec = 1000000000+end.tv_nsec-start.tv_nsec;
+ } else {
+ temp.tv_sec = end.tv_sec-start.tv_sec;
+ temp.tv_nsec = end.tv_nsec-start.tv_nsec;
+ }
+ return temp;
+}
+
+int32_t TWFunc::timespec_diff_ms(timespec& start, timespec& end)
+{
+ return ((end.tv_sec * 1000) + end.tv_nsec/1000000) -
+ ((start.tv_sec * 1000) + start.tv_nsec/1000000);
+}
+
#ifndef BUILD_TWRPTAR_MAIN
// Returns "/path" from a full /path/to/file.name
@@ -703,25 +722,6 @@ int TWFunc::write_file(string fn, string& line) {
return -1;
}
-timespec TWFunc::timespec_diff(timespec& start, timespec& end)
-{
- timespec temp;
- if ((end.tv_nsec-start.tv_nsec)<0) {
- temp.tv_sec = end.tv_sec-start.tv_sec-1;
- temp.tv_nsec = 1000000000+end.tv_nsec-start.tv_nsec;
- } else {
- temp.tv_sec = end.tv_sec-start.tv_sec;
- temp.tv_nsec = end.tv_nsec-start.tv_nsec;
- }
- return temp;
-}
-
-int32_t TWFunc::timespec_diff_ms(timespec& start, timespec& end)
-{
- return ((end.tv_sec * 1000) + end.tv_nsec/1000000) -
- ((start.tv_sec * 1000) + start.tv_nsec/1000000);
-}
-
bool TWFunc::Install_SuperSU(void) {
if (!PartitionManager.Mount_By_Path("/system", true))
return false;