vlang
  • 目录
    • V语言学习笔记
    • 目录
    • 安装
    • 开发工具
    • 快速总览
    • 模块
    • 基本类型
    • 变量
    • 常量
    • 枚举
    • 数组
    • 字典
    • 流程控制
    • 函数
    • 结构体
    • 访问控制
    • 方法
    • 注解
    • 接口
    • 泛型
    • 类型别名
    • 联合类型
    • 联合体
    • 错误处理
    • 运算符重载
    • 内置json支持
    • 内置sql支持
    • 并发
    • 内存管理
    • 代码测试
    • 文档生成
    • 编译时代码
    • 包管理器
    • 单个V文件
    • V shell script
    • 不安全代码
    • 集成C代码库
    • 集成汇编代码
    • 裸机环境
    • 生成wasm
    • GUI开发
    • web开发
    • 数据库开发
  • builtin
  • strings
  • arrays
  • maps
  • datatypes
  • strconv
  • os
  • runtime
  • time
  • math
  • json
  • encoding
  • compress
  • toml
  • flag
  • term
  • log
  • io
  • readline
  • reflection
  • net
  • net.http
  • eventbus
  • regex
  • crypto
  • rand
  • sync
  • x
  • db.pg
  • db.mysql
  • db.mssql
  • db.sqlite
  • orm
  • ui
  • sokol
  • gg
  • gx
  • fontstash
  • stbi
  • clipboard
  • V抽象语法树
  • V语言服务
  • V编译器源代码
  • 生成C代码
  • 生成js代码
  • 生成go代码
  • 生成native代码
  • 解释器直接运行
  • 附录1 关键字
  • 附录2 运算符
  • 附录3 编码风格
  • 附录4 V编译器命令行使用
  • 附录5 V调试及错误定位
  • 附录6 V和Go基本语法参照
  • 附录7 V和Zig基本语法参照
由 GitBook 提供支持
在本页

这有帮助吗?

time

基于C标准库进行封装

time结构体

pub struct Time {
pub:
    year   int
    month  int
    day    int
    hour   int
    minute int
    second int
    unix int
}

time方法

//返回月份的字符串简称
pub fn (t Time) smonth() string 
//计算unix时间
pub fn (t &Time) calc_unix() int
//增加秒
pub fn (t Time) add_seconds(seconds int)
//增加天
pub fn (t Time) add_days(days int) Time
//某个时间距离当前时间有多久
pub fn (t Time) relative() string
...

公共函数

//返回当前时间
pub fn now() Time
//返回时间
pub fn new_time(t Time) Time
//进程休眠,等待参数指定的时间长度:
//秒:  n*time.second
//毫秒: n*time.millisecond
//微秒: n*time.microsecond
//纳秒: n*time.nanosecond

//nanosecond  = Duration(1)
//microsecond = Duration(1000 * nanosecond)
//millisecond = Duration(1000 * microsecond)
//second      = Duration(1000 * millisecond)
//minute      = Duration(60 * second)
//hour        = Duration(60 * minute)
pub fn wait(duration Duration)
//判断是否闰年
pub fn is_leap_year(year int) bool
...
上一页runtime下一页math

最后更新于4年前

这有帮助吗?