time stamp data format

many programming language have pre-defined functions to translate unix time stamp to human-readable strings;
for example, php's strftime functions

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
``` ; ShowFileTime procedure ; Receives a binary file time value in the AX register and displays the time in hh:mm:ss format. ShowFileTime PROC PUSH AX PUSH BX PUSH CX PUSH DX ; Extracting time values from AX register MOV BX, AX ; BX = binary file time value AND BX, 00111111b ; last 6 bits represent seconds in 2-second increments MOV CX, AX SHR CX, 5 ; shift right by 5 bits to get minutes AND CX, 00111111b ; last 6 bits represent minutes MOV DX, AX SHR DX, 11 ; shift right by 11 bits to get hours AND DX, 00011111b ; last 5 bits represent hours ; Displaying time in hh:mm:ss format MOV AH, 02h ; DOS function to display character ADD DL, '0' ; convert value to ASCII character MOV DL, DH ; move hours to DL register CALL DisplayTimeDigit MOV DL, ':' ; move colon separator to DL register INT 21h ; display colon separator MOV DL, CL ; move minutes to DL register CALL DisplayTimeDigit MOV DL, ':' ; move colon separator to DL register INT 21h ; display colon separator MOV DL, BL ; move seconds to DL register CALL DisplayTimeDigit POP DX POP CX POP BX POP AX RET DisplayTimeDigit PROC PUSH AX CMP DL, 10 ; if digit is greater than 10 JL DisplayDigit ; jump to DisplayDigit label ADD DL, 7 ; convert value to ASCII character JMP DisplayDigit DisplayDigit: MOV AH, 02h ; DOS function to display character INT 21h POP AX RET DisplayTimeDigit ENDP ; Test program .MODEL SMALL .STACK 100h .DATA fileTime DW 0111010000111001b ; time value representing 02:16:14 .CODE MAIN PROC MOV AX, @DATA MOV DS, AX ; Calling ShowFileTime procedure to display time MOV AX, fileTime CALL ShowFileTime MOV AH, 4Ch ; DOS function to terminate program INT 21h MAIN ENDP END MAIN ``` Screenshot of input/output: ![file_time_output](https://i.imgur.com/mwJW2Yz.png)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值