#include <dlog.h>
#include <livebox-errno.h> /* For error code */
+#include <tzplatform_config.h>
#include "debug.h"
#include "util.h"
if (s_info.type == CLOCK_MONOTONIC) {
s_info.type = CLOCK_REALTIME;
} else if (s_info.type == CLOCK_REALTIME) {
- break;
+ struct timeval tv;
+ if (gettimeofday(&tv, NULL) < 0) {
+ ErrPrint("gettimeofday: %s\n", strerror(errno));
+ break;
+ }
+
+ return tv.tv_sec + tv.tv_usec / 1000000.0f;
}
} while (1);
#else
struct timeval tv;
- gettimeofday(&tv, NULL);
+ if (gettimeofday(&tv, NULL) < 0) {
+ ErrPrint("gettimeofday: %s\n", strerror(errno));
+ tv.tv_sec = 0;
+ tv.tv_usec = 0;
+ }
+
return (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0f;
#endif
}
int len;
char *path;
- len = strlen(pkgname) * 2;
- len += strlen("/opt/usr/live/%s/libexec/liblive-%s.so");
+ /* get lenght of path */
+ len = snprintf(NULL, 0, "%s/%s/libexec/liblive-%s.so",tzplatform_getenv(TZ_USER_LIVE),pkgname, pkgname);
path = malloc(len + 1);
if (!path) {
return LB_STATUS_ERROR_MEMORY;
}
- snprintf(path, len, "/opt/usr/live/%s/libexec/liblive-%s.so", pkgname, pkgname);
+ snprintf(path, len, "%s/%s/libexec/liblive-%s.so",tzplatform_getenv(TZ_USER_LIVE),pkgname, pkgname);
if (access(path, F_OK | R_OK) != 0) {
ErrPrint("%s is not a valid package\n", pkgname);
free(path);
int len;
char *path;
- len = strlen(pkgname) * 2;
- len += strlen("/opt/usr/apps/%s/res/wgt/livebox/index.html");
+ /* get lenght of path*/
+ len = snprintf(NULL, 0, "%s/%s/res/wgt/livebox/index.html",tzplatform_getenv(TZ_USER_APP),pkgname);
path = malloc(len + 1);
if (!path) {
return LB_STATUS_ERROR_MEMORY;
}
- snprintf(path, len, "/opt/usr/apps/%s/res/wgt/livebox/index.html", pkgname);
+ snprintf(path, len, "%s/%s/res/wgt/livebox/index.html",tzplatform_getenv(TZ_USER_APP) ,pkgname);
if (access(path, F_OK | R_OK) != 0) {
ErrPrint("%s is not a valid package\n", pkgname);
free(path);