Knox Tizen Wearable SDK
Date Time policy group

Date Time policy group provides policies for date time control. More...

Functions

mdm_data_tmdm_get_date_format (void)
 API to get the date format. More...
 
mdm_data_tmdm_get_time_format (void)
 API to get the device time. More...
 
mdm_data_tmdm_get_time_zone (void)
 API to get the device time zone as a valid ID. More...
 
mdm_data_tmdm_get_date_time (void)
 API to get the date and time. More...
 
mdm_result_t mdm_get_automatic_time (int *p_value)
 API to get whether automatic time updates using Network Identity and Time Zone (NITZ) is enabled. More...
 
mdm_result_t mdm_get_daylight_saving_time (int *p_value)
 API to get the daylight saving time state. More...
 
mdm_result_t mdm_set_automatic_time (int enabled)
 API to set whether to use automatic time updates using Network Identity and Time Zone (NITZ). More...
 
mdm_result_t mdm_set_date_format (const char *p_format)
 API to set the device date format. More...
 
mdm_result_t mdm_set_date_time (int day, int month, int year, int hour, int minute, int second)
 API to set the device date and time. More...
 
mdm_result_t mdm_set_time_format (const char *p_format)
 API to set the device time format. More...
 
mdm_result_t mdm_set_time_zone (const char *p_timezoneid)
 API to set the device TimeZone. More...
 
mdm_result_t mdm_set_date_time_change_enabled (bool enabled)
 API to set whether the user can change the date and time. More...
 
mdm_status_t mdm_is_date_time_change_enabled (void)
 API to check whether the user can change the date and time. More...
 

Detailed Description

Date Time policy group provides policies for date time control.

Date Time policy group.

Required Header

#include <mdm.h>

Overview

This group provides APIs to control the various settings related to device date and time. This includes disabling and enabling, making configurations and querying the current date and time settings.

Function Documentation

mdm_result_t mdm_get_automatic_time ( int *  p_value)

API to get whether automatic time updates using Network Identity and Time Zone (NITZ) is enabled.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.1.5
Feature:
http://developer.samsung.com/tizen/feature/mdm
Usage:
Admin can check if automatic time is enabled on the device. If so, the device uses Network Identity and Time Zone (NITZ) to update its time and date.
int value = 0;
mdm_result_t ret = 0;
ret = mdm_get_automatic_time(&value);
if (ret == MDM_RESULT_SUCCESS) {
printf("time %d", value);
}
Parameters
[out]p_valueWhether NITZ is enabled. Valid values are '1' for enabled or '0' for disabled.
Returns
mdm_result_t : MDM_RESULT_SUCCESS on success, an error code on error
Return values
MDM_RESULT_SUCCESSSuccessful
MDM_RESULT_FAILGeneral failure
MDM_RESULT_NOT_SUPPORTEDNot supported
MDM_RESULT_INVALID_PARAMInvalid parameter
MDM_RESULT_ACCESS_DENIEDThe application does not have the privilege to call this function.
See also
mdm_set_automatic_time()
mdm_data_t* mdm_get_date_format ( void  )

API to get the date format.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.1.5
Feature:
http://developer.samsung.com/tizen/feature/mdm
Usage:
Admin can get the current date set on the device as: DD/MM/YYYY, MM/DD/YYYY, or YYYY/MM/DD.
if (lp_data) {
char *temp = (char *)lp_data->data;
if (temp) {
printf("format : %s", temp);
}
mdm_free_data(lp_data);
}
Returns
The date format on success. Otherwise. returns NULL.
See also
mdm_set_date_format()
mdm_data_t* mdm_get_date_time ( void  )

API to get the date and time.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.1.5
Feature:
http://developer.samsung.com/tizen/feature/mdm
Usage:
Admin gets the current date and time set on the device. Date time is returned in one of the following custom formats: ddd MMM dd HH:mm 'GMT' zzz yyyy or ddd MMM dd h:mm tt 'GMT' zzz yyyy. For example: Wed Nov 18 7:40 PM GMT +9:00 2014.
if (lp_data) {
char *temp = (char *)lp_data->data;
if (temp) {
printf("date time : %s", temp);
}
mdm_free_data(lp_data);
}
Returns
The current data and time on success. Otherwise, returns NULL.
See also
mdm_set_date_time()
mdm_result_t mdm_get_daylight_saving_time ( int *  p_value)

API to get the daylight saving time state.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.1.5
Feature:
http://developer.samsung.com/tizen/feature/mdm
Usage:
Admin can get the current daylight saving time state of the device. This is whether the device is currently in a timeZone with Daylight Saving Time.
int value = 0;
mdm_result_t ret = 0;
if (ret == MDM_RESULT_SUCCESS) {
printf("time %d", value);
}
Parameters
[out]p_valueWhether the device is in a timeZone that uses Daylight Savings Time. The value is positive if daylight saving time is in effect, zero if it is not, and negative if the information is not available.
Returns
mdm_result_t : MDM_RESULT_SUCCESS on success, an error code on error
Return values
MDM_RESULT_SUCCESSSuccessful
MDM_RESULT_FAILGeneral failure
MDM_RESULT_NOT_SUPPORTEDNot supported
MDM_RESULT_INVALID_PARAMInvalid parameter
MDM_RESULT_ACCESS_DENIEDThe application does not have the privilege to call this function.
See also
mdm_get_time_zone(), mdm_set_time_zone()
mdm_data_t* mdm_get_time_format ( void  )

API to get the device time.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.1.5
Feature:
http://developer.samsung.com/tizen/feature/mdm
Usage:
Admin can get the current device time. This is either in 12h or 24h format, which can be set by mdm_set_time_format().
if (lp_data) {
char *temp = (char *)lp_data->data;
if (temp) {
printf("time : %s", temp);
}
mdm_free_data(lp_data);
}
Returns
The device time on success. Otherwise, returns NULL.
See also
mdm_set_time_format()
mdm_data_t* mdm_get_time_zone ( void  )

API to get the device time zone as a valid ID.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.1.5
Feature:
http://developer.samsung.com/tizen/feature/mdm
Usage:
Admin can get the current timeZone set on the device. For example, America/Denver. DateTimeSettings in the device's Settings application lists the possible timeZone values.
if (lp_data) {
char *temp = (char *)lp_data->data;
if (temp) {
printf("timezone : %s", temp);
}
mdm_free_data(lp_data);
}
Returns
The timeZone of the device on success. Otherwise, returns NULL.
See also
mdm_set_time_zone()
mdm_status_t mdm_is_date_time_change_enabled ( void  )

API to check whether the user can change the date and time.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.2.3
Feature:
http://developer.samsung.com/tizen/feature/mdm
Usage:
Admin can check whether the Date Time Change policy is enabled. By default, the policy is enabled.
if (ret == MDM_ENABLED){
// Date Time Change setting enabled
} else if (ret == MDM_DISABLED) {
// Date Time Change setting disabled
}
Returns
mdm_status_t : Whether the user can change the date and time
Return values
MDM_ENABLEDChange of date and time enabled
MDM_DISABLEDOtherwise
See also
mdm_set_date_time_change_enabled()
mdm_result_t mdm_set_automatic_time ( int  enabled)

API to set whether to use automatic time updates using Network Identity and Time Zone (NITZ).

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.2.3
Feature:
http://developer.samsung.com/tizen/feature/mdm
Usage:
Admin can enable the use of NITZ (Network Identity and Time Zone) on the device.
mdm_result_t ret = 0;
if (ret != MDM_RESULT_SUCCESS) {
// function error
} else {
// function success
}
Privilege Level:
public
Privilege:
http://developer.samsung.com/tizen/privilege/mdm.datetime
Parameters
[in]enabledDetermines whether to enable or disable automatic time updates using NITZ. Use MDM_TRUE to enable NITZ, or use MDM_FALSE to disable NITZ.
Returns
mdm_result_t : MDM_RESULT_SUCCESS on success, an error code on error
Return values
MDM_RESULT_SUCCESSSuccessful
MDM_RESULT_FAILGeneral failure
MDM_RESULT_NOT_SUPPORTEDNot supported
MDM_RESULT_INVALID_PARAMInvalid parameter
MDM_RESULT_ACCESS_DENIEDThe application does not have the privilege to call this function.
Permission:
This API is restricted to registered clients only.
See also
mdm_get_automatic_time()
mdm_result_t mdm_set_date_format ( const char *  p_format)

API to set the device date format.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.2.3
Feature:
http://developer.samsung.com/tizen/feature/mdm
Usage:
Admin can set the device date format on the device
mdm_result_t ret = 0;
ret = mdm_set_date_format("YYYY/DD/MM");
if (ret != MDM_RESULT_SUCCESS) {
// function error
} else {
// function success
}
Privilege Level:
public
Privilege:
http://developer.samsung.com/tizen/privilege/mdm.datetime
Parameters
[in]p_formatThe date format to set. Acceptable values are: DD/MM/YYYY, MM/DD/YYYY, or YYYY/MM/DD.
Returns
mdm_result_t : MDM_RESULT_SUCCESS on success, an error code on error
Return values
MDM_RESULT_SUCCESSSuccessful
MDM_RESULT_FAILGeneral failure
MDM_RESULT_NOT_SUPPORTEDNot supported
MDM_RESULT_INVALID_PARAMInvalid parameter
MDM_RESULT_ACCESS_DENIEDThe application does not have the privilege to call this function.
Permission:
This API is restricted to registered clients only.
See also
mdm_get_date_format()
mdm_result_t mdm_set_date_time ( int  day,
int  month,
int  year,
int  hour,
int  minute,
int  second 
)

API to set the device date and time.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.2.3
Feature:
http://developer.samsung.com/tizen/feature/mdm
Usage:
Admin can provide date parameters to set the date and time of the device.
mdm_result_t ret = 0;
int day = 23, month = 12, year = 2013, hour = 1, minute = 10, second = 20;
ret = mdm_set_date_time(day, month, year, hour, minute, second);
if (ret != MDM_RESULT_SUCCESS) {
// function error
} else {
// function success
}
Privilege Level:
public
Privilege:
http://developer.samsung.com/tizen/privilege/mdm.datetime
Parameters
[in]dayDay of month to which the device date is to be set.
[in]monthMonth to which the device date is to be set.
[in]yearYear to which the device date is to be set.
[in]hourHour of day to which the device time is to be set.
[in]minuteMinute to which the device time is to be set.
[in]secondSecond to which the device time is to be set.
Returns
mdm_result_t : MDM_RESULT_SUCCESS on success, an error code on error
Return values
MDM_RESULT_SUCCESSSuccessful
MDM_RESULT_FAILGeneral failure
MDM_RESULT_NOT_SUPPORTEDNot supported
MDM_RESULT_INVALID_PARAMInvalid parameter
MDM_RESULT_ACCESS_DENIEDThe application does not have the privilege to call this function.
Permission:
This API is restricted to registered clients only.
Attention
Automatic time option, has a higher priority!
See also
mdm_get_date_time()
mdm_set_automatic_time()
mdm_result_t mdm_set_date_time_change_enabled ( bool  enabled)

API to set whether the user can change the date and time.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.2.3
Feature:
http://developer.samsung.com/tizen/feature/mdm
Usage:
Admin can use this API to control the user's access to the Date Time Setting. Call this function with enabled set to true to allow the user to change the date and time, or use false to disable this ability.
mdm_result_t ret = 0;
if (ret != MDM_RESULT_SUCCESS) {
// function error
} else {
// function success
}
Privilege Level:
public
Privilege:
http://developer.samsung.com/tizen/privilege/mdm.datetime
Parameters
[in]enabledThe status of the policy. Use true to enable the policy or false to disable the policy.
Returns
mdm_result_t : MDM_RESULT_SUCCESS on success, an error code on error
Return values
MDM_RESULT_SUCCESSSuccessful
MDM_RESULT_FAILGeneral failure
MDM_RESULT_NOT_SUPPORTEDNot supported
MDM_RESULT_INVALID_PARAMInvalid parameter
MDM_RESULT_ACCESS_DENIEDThe application does not have the privilege to call this function.
Permission:
This API is restricted to registered clients only.
See also
mdm_is_date_time_change_enabled()
mdm_result_t mdm_set_time_format ( const char *  p_format)

API to set the device time format.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.2.3
Feature:
http://developer.samsung.com/tizen/feature/mdm
Usage:
Admin can set the device time format to 12h or 24h. For example, 3:17 PM is 3:17 in 12h format, and 15:17 in 24h format.
mdm_result_t ret = 0;
ret = mdm_set_time_format("12");
if (ret != MDM_RESULT_SUCCESS) {
// function error
} else {
// function success
}
Privilege Level:
public
Privilege:
http://developer.samsung.com/tizen/privilege/mdm.datetime
Parameters
[in]p_formatThe time format to use. Use "12" for 12h format, or "24" for 24h format.
Returns
mdm_result_t : MDM_RESULT_SUCCESS on success, an error code on error
Return values
MDM_RESULT_SUCCESSSuccessful
MDM_RESULT_FAILGeneral failure
MDM_RESULT_NOT_SUPPORTEDNot supported
MDM_RESULT_INVALID_PARAMInvalid parameter
MDM_RESULT_ACCESS_DENIEDThe application does not have the privilege to call this function.
Permission:
This API is restricted to registered clients only.
See also
mdm_get_time_format()
mdm_result_t mdm_set_time_zone ( const char *  p_timezoneid)

API to set the device TimeZone.

Since (Knox_wearable):
1.0.0
Since (Tizen):
2.3.2.3
Feature:
http://developer.samsung.com/tizen/feature/mdm
Usage:
Admin can provide a TimeZone ID to set the device TimeZone. DateTimeSettings in the device's Settings application lists the possible timeZone values.
mdm_result_t ret = 0;
ret = mdm_set_time_zone("Asia/Seoul");
if (ret != MDM_RESULT_SUCCESS) {
// function error
} else {
// function success
}
Privilege Level:
public
Privilege:
http://developer.samsung.com/tizen/privilege/mdm.datetime
Parameters
[in]p_timezoneidThe timezone to use for the device (for example, America/Detroit). DateTimeSettings in the device's Settings application lists the possible values.
Returns
mdm_result_t : MDM_RESULT_SUCCESS on success, an error code on error
Return values
MDM_RESULT_SUCCESSSuccessful
MDM_RESULT_FAILGeneral failure
MDM_RESULT_NOT_SUPPORTEDNot supported
MDM_RESULT_INVALID_PARAMInvalid parameter
MDM_RESULT_ACCESS_DENIEDThe application does not have the privilege to call this function.
Permission:
This API is restricted to registered clients only.
See also
mdm_get_time_zone()