⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 u_utils.pas

📁 linux program to read packet data
💻 PAS
字号:
(*
 * One Way Network Sniffer (OWNS)
 * Copyright (C) 2001-2002 OWNS
 *
 * http://owns.sourceforge.net/
 * http://www.owns.st
 *
 * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *)

(*
 * $Id: u_utils.pas,v 1.3 2002/11/02 14:05:38 owns Exp $
 *
 *)

unit u_utils;
interface
uses
  SysUtils,
{$IFDEF LINUX}
  Libc
{$ENDIF}
{$IFDEF MSWINDOWS}
  idglobal
{$ENDIF}
;

function getTickCount2 : Cardinal;
function convertPath(p_FilePath : String) : String;

implementation

// getTickCOunt seems to be buggy under Kylix

{$IFDEF MSWINDOWS}
function getTickCount2 : Cardinal;
begin
  result := getTickCount;
end;
{$ENDIF}

{$IFDEF LINUX}
function getTickCount2 : Cardinal;
var
  l_TimeVal : TTimeVal;
begin
  gettimeofday(l_timeval,nil);
  result := l_TimeVal.tv_sec*1000 + l_TimeVal.tv_usec div 1000;
end;
{$ENDIF}

// convert path
function convertPath(p_FilePath : String) : String;
var
  i : integer;
begin
  result := p_FilePath;
  for i := 1 to length(result) do
  begin
    // this way, we are compatible with linux and windows
    if (result[i] = '\') or (result[i] = '/') then
      result[i] := PathDelim;
  end;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -