• 大小: 14.11MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-06-29
  • 语言: 其他
  • 标签: TCP  SSL  Cyclone  

资源简介

用于连接京东云时TCP SSL加密方式连接的开源代码

资源截图

代码片段和文件信息

/**
 * @file date_time.c
 * @brief Date and time management
 *
 * @section License
 *
 * Copyright (C) 2010-2014 Oryx embedded. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not write to the Free Software Foundation
 * Inc. 51 Franklin Street Fifth Floor Boston MA  02110-1301 USA.
 *
 * @author Oryx embedded (www.oryx-embedded.com)
 * @version 1.5.0
 **/

//Dependencies
#include 
#include 
#include “date_time.h“

#if defined(_WIN32)
   #include 
#endif

//Days
static const char days[8][10] =
{
   ““
   “Monday“
   “Tuesday“
   “Wednesday“
   “Thursday“
   “Friday“
   “Saturday“
   “Sunday“
};

//Months
static const char months[13][10] =
{
   ““
   “January“
   “February“
   “March“
   “April“
   “May“
   “June“
   “July“
   “August“
   “September“
   “October“
   “November“
   “December“
};


/**
 * @brief Format system time
 * @param[in] time System time
 * @param[out] str NULL-terminated string representing the specified time
 * @return Pointer to the formatted string
 **/

const char_t *formatSystemTime(systime_t time char_t *str)
{
   uint16_t hours;
   uint8_t minutes;
   uint8_t seconds;
   uint16_t milliseconds;
   static char_t buffer[24];

   //Retrieve milliseconds
   milliseconds = time % 1000;
   time /= 1000;
   //Retrieve seconds
   seconds = time % 60;
   time /= 60;
   //Retrieve minutes
   minutes = time % 60;
   time /= 60;
   //Retrieve hours
   hours = time;

   //The str parameter is optional
   if(!str) str = buffer;

   //Format system time
   if(hours > 0)
   {
      sprintf(str “%“ PRIu16 “h %02“ PRIu8 “min %02“ PRIu8 “s %03“ PRIu16 “ms“
         hours minutes seconds milliseconds);
   }
   else if(minutes > 0)
   {
      sprintf(str “%“ PRIu8 “min %02“ PRIu8 “s %03“ PRIu16 “ms“
         minutes seconds milliseconds);
   }
   else if(seconds > 0)
   {
      sprintf(str “%“ PRIu8 “s %03“ PRIu16 “ms“ seconds milliseconds);
   }
   else
   {
      sprintf(str “%“ PRIu16 “ms“ milliseconds);
   }

   //Return a pointer to the formatted string
   return str;
}


/**
 * @brief Format date
 * @param[in] date Pointer to a structure representing the date
 * @param[out] str NULL-terminated string representing the specified date
 * @return Pointer to the formatted string

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2014-09-16 18:12  CycloneTCP_SSL_Crypto_Open_1_5_0\
     目录           0  2014-09-16 18:11  CycloneTCP_SSL_Crypto_Open_1_5_0\common\
     文件        2648  2014-09-15 21:51  CycloneTCP_SSL_Crypto_Open_1_5_0\common\compiler_port.h
     文件        7219  2014-09-10 15:35  CycloneTCP_SSL_Crypto_Open_1_5_0\common\date_time.c
     文件        1744  2014-09-10 15:35  CycloneTCP_SSL_Crypto_Open_1_5_0\common\date_time.h
     文件        1781  2014-09-10 15:35  CycloneTCP_SSL_Crypto_Open_1_5_0\common\debug.c
     文件        3344  2014-09-10 15:35  CycloneTCP_SSL_Crypto_Open_1_5_0\common\debug.h
     文件        1559  2014-09-10 15:35  CycloneTCP_SSL_Crypto_Open_1_5_0\common\endian.c
     文件        7171  2014-09-10 15:35  CycloneTCP_SSL_Crypto_Open_1_5_0\common\endian.h
     文件        6141  2014-09-10 15:35  CycloneTCP_SSL_Crypto_Open_1_5_0\common\error.h
     文件        4219  2014-09-10 15:35  CycloneTCP_SSL_Crypto_Open_1_5_0\common\fs_port.h
     文件       17105  2014-09-10 15:35  CycloneTCP_SSL_Crypto_Open_1_5_0\common\fs_port_fatfs.c
     文件        4031  2014-09-10 15:35  CycloneTCP_SSL_Crypto_Open_1_5_0\common\os_port.h
     文件       14162  2014-09-10 15:35  CycloneTCP_SSL_Crypto_Open_1_5_0\common\os_port_chibios.c
     文件        3561  2014-09-10 15:35  CycloneTCP_SSL_Crypto_Open_1_5_0\common\os_port_chibios.h
     文件       13956  2014-09-10 15:35  CycloneTCP_SSL_Crypto_Open_1_5_0\common\os_port_cmsis_rtos.c
     文件        3343  2014-09-10 15:35  CycloneTCP_SSL_Crypto_Open_1_5_0\common\os_port_cmsis_rtos.h
     文件       12388  2014-09-10 15:35  CycloneTCP_SSL_Crypto_Open_1_5_0\common\os_port_freertos.c
     文件        3635  2014-09-10 15:35  CycloneTCP_SSL_Crypto_Open_1_5_0\common\os_port_freertos.h
     文件       14867  2014-09-10 15:35  CycloneTCP_SSL_Crypto_Open_1_5_0\common\os_port_rtx.c
     文件        3785  2014-09-10 15:35  CycloneTCP_SSL_Crypto_Open_1_5_0\common\os_port_rtx.h
     文件       16999  2014-09-10 15:35  CycloneTCP_SSL_Crypto_Open_1_5_0\common\os_port_ucos3.c
     文件        3570  2014-09-10 15:35  CycloneTCP_SSL_Crypto_Open_1_5_0\common\os_port_ucos3.h
     文件        9603  2014-09-10 15:35  CycloneTCP_SSL_Crypto_Open_1_5_0\common\os_port_windows.c
     文件        3287  2014-09-10 15:35  CycloneTCP_SSL_Crypto_Open_1_5_0\common\os_port_windows.h
     文件       11079  2014-09-10 15:35  CycloneTCP_SSL_Crypto_Open_1_5_0\common\path.c
     文件        1507  2014-09-10 15:35  CycloneTCP_SSL_Crypto_Open_1_5_0\common\path.h
     文件        8810  2014-09-10 15:35  CycloneTCP_SSL_Crypto_Open_1_5_0\common\resource_manager.c
     文件        2847  2014-09-15 21:40  CycloneTCP_SSL_Crypto_Open_1_5_0\common\resource_manager.h
     文件        4287  2014-09-10 15:35  CycloneTCP_SSL_Crypto_Open_1_5_0\common\str.c
     文件        1382  2014-09-10 15:35  CycloneTCP_SSL_Crypto_Open_1_5_0\common\str.h
............此处省略4243个文件信息

评论

共有 条评论