// File: DoubleString[P]RtConverter/src/Rnxobs/Log.cpp
// Function: bamboo::Log::m_chkUpdate(char const*, bamboo::LogItem*)
void Log::m_chkUpdate(const char* fil,LogItem* item){
	// check whether update the log file when the interval is coming
	if(item->lupd){
		char filname[1024] = {0};
		time_t now = time(NULL);
		struct tm* ptr;
		ptr = localtime(&now);
		int mjd = md_julday(ptr->tm_year + 1900,ptr->tm_mon + 1,ptr->tm_mday),gwk;
		double sod = ptr->tm_hour * 3600.0 + ptr->tm_min * 60.0 + ptr->tm_sec,gsow;
		mjd2wksow(mjd,sod,&gwk,&gsow);
		if(now - item->lastActive > item->interval){
			item->lastActive = (now / item->interval) * item->interval;
			item->of->flush();
			item->of->close();
			delete item->of;
			sprintf(filname,"%s.%04d%02d%02d-%02d:%02d:%02d",fil,ptr->tm_year + 1900,ptr->tm_mon + 1,ptr->tm_mday,ptr->tm_hour,
					ptr->tm_min,ptr->tm_sec);
			rename(fil,filname);
			item->of = new ofstream;
			item->of->open(fil, ios::out);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x490, %rsp            # imm = 0x490
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x14(%rax)
je 0x39c52
leaq -0x420(%rbp), %rdi
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x93d0
xorl %eax, %eax
movl %eax, %edi
callq 0x96e0
movq %rax, -0x428(%rbp)
leaq -0x428(%rbp), %rdi
callq 0x9590
movq %rax, -0x430(%rbp)
movq -0x430(%rbp), %rax
movl 0x14(%rax), %edi
addl $0x76c, %edi            # imm = 0x76C
movq -0x430(%rbp), %rax
movl 0x10(%rax), %esi
addl $0x1, %esi
movq -0x430(%rbp), %rax
movl 0xc(%rax), %edx
callq 0x32fe0
movl %eax, -0x434(%rbp)
movq -0x430(%rbp), %rax
cvtsi2sdl 0x8(%rax), %xmm0
movq -0x430(%rbp), %rax
cvtsi2sdl 0x4(%rax), %xmm1
movsd 0x8335b(%rip), %xmm2    # 0xbce18
mulsd %xmm2, %xmm1
movsd 0x83347(%rip), %xmm2    # 0xbce10
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq -0x430(%rbp), %rax
cvtsi2sdl (%rax), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0x440(%rbp)
movl -0x434(%rbp), %edi
movsd -0x440(%rbp), %xmm0
leaq -0x438(%rbp), %rsi
leaq -0x448(%rbp), %rdx
callq 0x33810
movq -0x428(%rbp), %rax
movq -0x18(%rbp), %rcx
subq 0x8(%rcx), %rax
movq -0x18(%rbp), %rcx
movslq 0x10(%rcx), %rcx
cmpq %rcx, %rax
jle 0x39c50
movq -0x428(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq 0x10(%rcx), %rcx
cqto
idivq %rcx
movq %rax, %rcx
movq -0x18(%rbp), %rax
movslq 0x10(%rax), %rax
imulq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rdi
callq 0x9510
movq -0x18(%rbp), %rax
movq (%rax), %rdi
callq 0x9a70
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x460(%rbp)
cmpq $0x0, %rax
je 0x39b8d
movq -0x460(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq -0x10(%rbp), %rdx
movq -0x430(%rbp), %rax
movl 0x14(%rax), %ecx
addl $0x76c, %ecx            # imm = 0x76C
movl 0x10(%rax), %r8d
incl %r8d
movl 0xc(%rax), %r9d
movl 0x8(%rax), %esi
movl (%rax), %r10d
movl 0x4(%rax), %edi
movq %rsp, %rax
movl %r10d, 0x10(%rax)
movl %edi, 0x8(%rax)
movl %esi, (%rax)
leaq 0x83910(%rip), %rsi     # 0xbd4d8
xorl %eax, %eax
leaq -0x420(%rbp), %rdi
movq %rdi, -0x470(%rbp)
callq 0x9150
movq -0x470(%rbp), %rsi
movq -0x10(%rbp), %rdi
callq 0x9470
movl $0x200, %edi            # imm = 0x200
callq 0x9780
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x468(%rbp)
callq 0x9cb0
jmp 0x39c0b
movq -0x468(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
movl $0x10, %edx
callq 0x90a0
jmp 0x39c50
movq -0x468(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x450(%rbp)
movl %eax, -0x454(%rbp)
callq 0x9700
jmp 0x39c5b
jmp 0x39c52
addq $0x490, %rsp            # imm = 0x490
popq %rbp
retq
movq -0x450(%rbp), %rdi
callq 0x9d20
nopw (%rax,%rax)