• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <stdio.h>
17 #include <string.h>
18 #include <time.h>
19 #include <wchar.h>
20 #include "test.h"
21 
22 /**
23  * @tc.name      : wcsftime_0100
24  * @tc.desc      : Format system time
25  * @tc.level     : Level 0
26  */
wcsftime_0100(void)27 void wcsftime_0100(void)
28 {
29     time_t rtime;
30     struct tm *timeinfo;
31     wchar_t buffer[80];
32     time(&rtime);
33     timeinfo = localtime(&rtime);
34     size_t result = wcsftime(buffer, 80, L"%I:%M%p", timeinfo);
35     if (!result) {
36         t_error("%s wcsftime failed", __func__);
37     }
38 }
39 
main(int argc,char * argv[])40 int main(int argc, char *argv[])
41 {
42     wcsftime_0100();
43     return t_status;
44 }