-
-
Save ltao31/1856b49b38f6c53d1445f22f960a6997 to your computer and use it in GitHub Desktop.
Calls a powershell script that gets system boot time and parses it into a structure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [bootTime_struct] = getSystemBootTime(ps_path) | |
% get the system boot time | |
if isempty(ps_path) | |
[~,bootTime] = system(['powershell -command "' pwd '\Utils\GetSystemBootTime.ps1"']); | |
else | |
[~,bootTime] = system(['powershell -command "' ps_path '\GetSystemBootTime.ps1"']); | |
end | |
bootTime = splitlines(bootTime); | |
[bootTime,matches] = strsplit(bootTime{1},{'-','+'}); | |
% split into year, month, day, hour, minutes, seconds, timezone | |
bootTime_struct.year = str2double(bootTime{1}(1:4)); | |
bootTime_struct.month = str2double(bootTime{1}(5:6)); | |
bootTime_struct.day = str2double(bootTime{1}(7:8)); | |
bootTime_struct.hour = str2double(bootTime{1}(9:10)); | |
bootTime_struct.min = str2double(bootTime{1}(11:12)); | |
bootTime_struct.second = str2double(bootTime{1}(13:end)); | |
bootTime_struct.timezone = str2double([matches{1} bootTime{end}]); | |
%bootTime_split = [s.y,s.mo,s.d,s.h,s.m,s.s,s.timezone]; | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment