You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
3.0 KiB
C

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/****************************************************************************/
/* Copyright (c) 2007,许继集团有限公司 */
/* All rights reserved. */
/* */
/* 模块描述: */
/** 时间处理模块,ST_TIMESTAMP ST_ENTRYTIME类型处理及转换
* @file timeutil.h */
/* */
/* 日期 作者 注释 */
/* 2007/09/13 ZYZ 创建文件,从老版copy */
/****************************************************************************/
#ifndef INC_ACSITIME_H_HEADER_INCLUDED_BE050203
#define INC_ACSITIME_H_HEADER_INCLUDED_BE050203
#include "ai_def.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* 本函数完成系统当前时间的获取UTime的品质属性这里不操作
* @param curtime 存放当前时间的Time变量
* @retval 无
*/
ST_VOID get_system_curtime(ST_TIMESTAMP *curtime);
/**
* 根据时间精度TimeAccuracy 把毫秒数转换为UTCTime的Fraction.
* 如果转换精度为0则认为全精度24位,另外转换过程中精确度保证为0.1ms
* @param milsecond 毫秒值
* @param time_precision 时间精度
* @retval ST_UINT32 UTCTime的Fraction
*/
ST_UINT32 convert_milsec_to_timefrac(ST_FLOAT milsecond, ST_INT32 time_precision);
/**
* 根据时间精度TimeAccuracy 把61850的时间Fraction转换为毫秒数Float32
* @param frac 61850的时间Fraction
* @param time_precision 时间精度
* @retval ST_FLOAT 毫秒数
*/
ST_FLOAT convert_timefrac_to_milsec(ST_UINT32 frac, ST_INT32 time_precision);
/**
* 计算两个timeStamp时间的间隔以毫秒数返回结果
* @param curtime 当前时间
* @param destime 稍后时间
* @retval ST_FLOAT 毫秒数
*/
ST_UINT32 calculate_timespan(ST_TIMESTAMP *curtime, ST_TIMESTAMP *destime);
/**
* 把一个时间间隔添加到一个绝对的时间标签上
* @param curtime 当前时间
* @param tmspan 时间差
* @retval 无
*/
ST_VOID add_timespan_to_curtm(ST_TIMESTAMP *curtime, ST_UINT32 tmspan);
/**
* 获取当前的EntryTime时间
* @param entrytime 存放当前时间的ENTRYTIME变量
* @retval 无
*/
ST_VOID get_current_entrytime(ST_ENTRYTIME *entrytime);
/**
* 把一个ST_TIMESTAMP类的时间转换为EntryTime时间
* @param timestamp timestamp时间
* @param entrytime entrytime时间
* @retval 无
*/
ST_VOID convert_timestamp_to_entrytime(ST_TIMESTAMP *timestamp, ST_ENTRYTIME *entrytime);
/**
* 把一个EntryTime类的时间转换为ST_TIMESTAMP时间
* @param timestamp timestamp时间
* @param entrytime entrytime时间
* @retval 无
*/
ST_VOID convert_entrytime_to_timestamp(ST_ENTRYTIME *entrytime, ST_TIMESTAMP *timestamp);
#ifdef __cplusplus
}
#endif
#endif /* end of 'already included' */