diff toolboxes/bioakustik_tools/conversion/s_to_hhmmss.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/toolboxes/bioakustik_tools/conversion/s_to_hhmmss.m	Tue Feb 10 15:05:51 2015 +0000
@@ -0,0 +1,20 @@
+function out = s_to_hhmmss(in)
+%input: time in s (integer)
+%output: string in hhmmss format
+
+hours = div(in,3600);
+mins = div(mod(in,3600),60);
+secs = mod(in,60);
+
+out = strcat(tostr(hours),tostr(mins),tostr(secs));
+
+
+function u=tostr(v)
+if(v<10)
+    u=sprintf('0%d',v);
+else
+     u=sprintf('%d',v);
+end
+
+function u=div(v,w)
+u=(floor(v/w));
\ No newline at end of file