Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <eiseljulian@gmail.com>2015-08-01 22:06:58 +0300
committerJulian Eisel <eiseljulian@gmail.com>2015-08-01 22:06:58 +0300
commit4ade467fc6adfc13ce9e21d7e50b366fce70ea5f (patch)
tree968418721b08baacd47bab95877bc08812f3046a /source/blender/blenlib/intern/timecode.c
parent7759782ee7c4e654641c9f7abb51631c86e3f29c (diff)
parenta3c5de3e3ca82d8ad5a28029f3ee9207929318a1 (diff)
Merge branch 'master' into UI-graphical-redesign
Conflicts: source/blender/blenkernel/BKE_blender.h source/blender/blenloader/intern/versioning_270.c source/blender/editors/interface/resources.c source/blender/makesdna/DNA_userdef_types.h
Diffstat (limited to 'source/blender/blenlib/intern/timecode.c')
-rw-r--r--source/blender/blenlib/intern/timecode.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/timecode.c b/source/blender/blenlib/intern/timecode.c
index 39ffbcd7ebe..4ae9249ec0d 100644
--- a/source/blender/blenlib/intern/timecode.c
+++ b/source/blender/blenlib/intern/timecode.c
@@ -187,6 +187,34 @@ size_t BLI_timecode_string_from_time(
return rlen;
}
+/**
+ * Generate time string and store in \a str
+ *
+ * \param str: destination string
+ * \param maxncpy: maximum number of characters to copy ``sizeof(str)``
+ * \param time_seconds: time total time in seconds
+ * \return length of \a str
+ */
+size_t BLI_timecode_string_from_time_simple(
+ char *str, const size_t maxncpy, const double time_seconds)
+{
+ size_t rlen;
+
+ /* format 00:00:00.00 (hr:min:sec) string has to be 12 long */
+ const int hr = ( (int) time_seconds) / (60 * 60);
+ const int min = (((int) time_seconds) / 60 ) % 60;
+ const int sec = ( (int) time_seconds) % 60;
+ const int hun = ( (int) (time_seconds * 100.0)) % 100;
+
+ if (hr) {
+ rlen = BLI_snprintf(str, maxncpy, "%.2d:%.2d:%.2d.%.2d", hr, min, sec, hun);
+ }
+ else {
+ rlen = BLI_snprintf(str, maxncpy, "%.2d:%.2d.%.2d", min, sec, hun);
+ }
+
+ return rlen;
+}
/**
* Generate time string and store in \a str
@@ -200,7 +228,7 @@ size_t BLI_timecode_string_from_time(
*
* \note in some cases this is used to print non-seconds values.
*/
-size_t BLI_timecode_string_from_time_simple(
+size_t BLI_timecode_string_from_time_seconds(
char *str, const size_t maxncpy, const int power, const float time_seconds)
{
size_t rlen;